Learn
Control Flow
Use conditions and loops to control how a Tekst program executes.
if, elif, else
conditions.tk
score = 82
if score >= 90:
print("excellent")
elif score >= 70:
print("pass")
else:
print("try again")while
while.tk
count = 0
while count < 5:
print(count)
count += 1for
Use for ... in ... to iterate over a collection or another iterable value.
for.tk
names = ["Ada", "Grace", "Ayaan"]
for name in names:
print(name)range
range.tk
for i in range(5):
print(i)List comprehensions
comprehension.tk
squares = [x * x for x in range(10)]
print(squares)Logical expressions
logical.tk
age = 16
has_permission = true
if age >= 16 and has_permission:
print("allowed")Handling errors
Use try and catch to handle runtime errors. Continue to the Error Handling guide for examples and recovery tips.
The current native compiler documents
if, elif, else, while, for, range, and list comprehensions as supported language features.