SE <<
Previous Next >> Loops
CL
條件判斷(Conditional Logic)
根據環境狀況做出不同的動作。
# 範例 1:如果前方有牆就左轉
if wall_in_front():
turn_left()
# 範例 2:如果有物品就撿起來
if object_here():
take()
# 範例 3:如果前方沒牆就前進,否則左轉
if not wall_in_front():
move()
else:
turn_left()
SE <<
Previous Next >> Loops