2 Control Flow
Sasha Koshka edited this page 2022-09-03 04:52:56 +00:00

ARF has a collection of basic control flow phrases which are break, next, and return. Break breaks out of a loop or switch case, next is basically just a continue statement but using less letters, and a return phrase returns from the current function. Return phrases are entirely optional and do not take any arguments.

ARF also has some control flow phrases that expect an indented block of phrases under them:

defer
	something

if condition
	something

if condition
	something
elseif condition
	otherThing
else
	otherOtherThing

while condition
	something

switch value
: 324
	something
: 93284
	otherThing
:
	defaultThing

for index:Size element:Int someArray
	something

These do what you'd expect them to, but for loops in ARF need some further explanation. Many modern languages allow you to iterate over data, and ARF is no exception. The first argument of a for loop must be an index of type Size, the second argument must be typed as an element of the third argument, which must be an array or inherit from an array. In the future there might be some iterateable interface that an object could fulfil.