-- Control flow examples in Bubble
-- Else-if chains (no more deep nesting!)
put 85 into score
if score is greater than or equal to 90 then
say "Grade: A"
else if score is greater than or equal to 80 then
say "Grade: B"
else if score is greater than or equal to 70 then
say "Grade: C"
else if score is greater than or equal to 60 then
say "Grade: D"
else
say "Grade: F"
end if
-- Repeat with step
say ""
say "Counting by 5s:"
repeat with i from 0 to 25 by 5
say tab(2) & i
end repeat
-- Repeat with down to
say ""
say "Countdown:"
repeat with i from 5 down to 1
say tab(2) & i & "..."
wait 0.5
end repeat
say tab(2) & "Blast off!"
-- Nested loops
say ""
say "Multiplication table (1-5):"
repeat with row from 1 to 5
put "" into line
repeat with col from 1 to 5
put padleft(text(row * col), 4) into cell
put line & cell into line
end repeat
say line
end repeat