Functions let you name a block of code and reuse it. bubblecode has two kinds: functions (which give back a value) and handlers (which perform an action).
Functions (return a value)
A function calculates something and gives you the result:
fn.bubbleHandlers (perform an action)
Handlers use on instead of function and don’t return a value — they just do something:
handler.bubbleMultiple parameters
Functions and handlers can take multiple parameters separated by commas:
multi.bubbleUsing functions inside expressions
Since functions return values, you can use them anywhere you’d use a number or string:
compose.bubbleExercise
Exercise
Write a function called "triple" that takes a number and returns it multiplied by 3. Then print the result of triple(7).
exercise.bubbleQuiz
Question 1 of 3
What is the difference between a function and a handler?