Control Flow
Control flow statements let your AI agents make decisions and handle different scenarios.
If/Elif/Else
if condition:
# do something
elif another_condition:
# do something else
else:
# fallbackFor Loops
for item in collection:
process(item)While Loops
while condition:
# keep goingComprehensions
Pythonic one-liners:
# List comprehension
squares = [x**2 for x in range(10)]
# Dict comprehension
word_lengths = {w: len(w) for w in words}