Riddle supports some basic statements for control flow
if StatementThe if statement evaluates an expression and changes the program flow
depending on the result. It uses the if, elif and else keywords, and the
optional code blocks are started with : and indented, Python-style:
if a == 0:
print("a is zero")
elif a < 0:
print("a is negative")
else:
print("a is positive")
while StatementThe while statement evaluates an expression and keeps running a code block as
long as the expression remains true:
a = 0:
while a < 10:
a = a + 1
for StatementThe for statement iterates on the values of a range
for a in [1,2,3]:
print(a)
break StatementThe break statement can provide an exit from the closer while or for
loop:
a = 0:
while true:
a = a + 1
if a == 10:
break
return StatementThe return statement interrupts the entire function and optionally returns a
value.