Skip to content

Instantly share code, notes, and snippets.

@lf-araujo
Created August 21, 2018 17:27
Show Gist options
  • Save lf-araujo/62e5836ca6804c6d0247b261992829d4 to your computer and use it in GitHub Desktop.
Save lf-araujo/62e5836ca6804c6d0247b261992829d4 to your computer and use it in GitHub Desktop.
Data Flow with While Statements and Loops
*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.*
Here is a for loop that will print a series of numbers and report that it is finished:
```
[indent=4]
init
for var I = 1 to 10
print I.to_string()
print("All done!")
```
Now a simple while loop to achieve the same goal as the previous example:
```
[indent=4]
init
var loop = 1
while loop <= 10
print loop.to_string()
loop = loop + 1
```
That's it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment