Control Flow Examples

If / elif / else

File: examples/if_else.aja

score = float(input("Score? "))

if score >= 90:
    print("A")
elif score >= 80:
    print("B")
elif score >= 70:
    print("C")
else:
    print("D")

While and do-while

File: examples/while.aja

keep = True
b = 0

while keep do:
    b++
    keep = False

x = 0
do:
    x++
while False

print(b)
print(x)

For loop + increment sugar

File: examples/hooh.aja

b = 0
for a in range(10):
    b++
print(b)

Const and loop control

File: examples/map_const.aja

imut app = "ajasendiri"
print(app)

scores = {"alice": 10, "bob": 20}
print(scores["alice"])
scores["alice"] = 11
print(length(scores))

for i in range(10):
    if i == 3:
        continue
    if i == 6:
        break
    print(i)