Guest User

Untitled

a guest
Aug 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. *This is part of a series of posts about the Genie programming language. I am updating my progress in learning the language from scratch in the hopes it will be useful for anyone also trying to get to programming in the linux/Gtk world. This is an extremely basic overview of how loops look like in Genie. If you have any experience with other languages, there will be nothing new to you.*
  2.  
  3. Here is a for loop that will print a series of numbers and report that it is finished:
  4.  
  5. ```
  6. [indent=4]
  7. init
  8. for var I = 1 to 10
  9. print I.to_string()
  10. print("All done!")
  11. ```
  12.  
  13. Now a simple while loop to achieve the same goal as the previous example:
  14.  
  15.  
  16. ```
  17. [indent=4]
  18. init
  19.  
  20. var loop = 1
  21. while loop <= 10
  22. print loop.to_string()
  23. loop = loop + 1
  24. ```
  25.  
  26. That's it.
Add Comment
Please, Sign In to add comment