Programs need to make decisions. bubblecode uses if, else, and end if with English-like comparisons.
Simple if
if.bubbleThe code inside if ... end if only runs when the condition is true.
if / else
Use else to handle what happens when the condition is false:
ifelse.bubbleMultiple conditions
Chain conditions with else if:
grades.bubbleComparisons you can use
Here are the English-like comparisons bubblecode supports:
isoris equal to— checks equalityis notoris not equal to— checks inequalityis greater than— largeris less than— smalleris greater than or equal to— at leastis less than or equal to— at most
compare.bubbleExercise
Exercise
Create a variable "temp" with value 35. If temp is greater than 30, print "It is hot!". Otherwise print "It is cool."
exercise.bubbleQuiz
Question 1 of 3
What keyword ends an if block in bubblecode?