Skip to main content

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.

# Moves the pointer right one by one upto the number in the memory πŸ“¦
for memory move pointer right
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.