For
The for
statement lets you repeat a statement a specified number of times.
Heard of single line for? Bet you havenβt π
tldr;β
- Do repetitive stuff with the for πββοΈπ¨
- No variable initialization π²
- Enter a positive integer π’ or pass the pointer π or memory π¦
Repetitive stuff is easy with the for
β
Infant Lang has one of the easiest for
loop constructions.
Simply pass a number π’ to do a repetitive task for the specified number of times.
You can do crazy stuff with the for
loop.
For example, move a pointer insanely fast, print a lot of stuff, and check the condition multiple times whether it fulfills or not.
You can also pass the if
statement, which gets executed if the condition is fulfilled.
- Move Pointers
- Check a condition
- Print Stuff
# Moves the pointer right one by one upto the number in the memory π¦
for memory move pointer right
for pointer if memory == pointer memory = pointer + 1
for 5 print char 77
for 6 print char 101
for 7 print char 111
for 8 print char 119
danger
The for
requires a number to be passed to it. Be it a pointer, memory or arbitrary number. But make sure you donβt pass a negative number. And don't leave it empty either. π€
If you did, it throws an error and stops the execution.