Menu

bubblecode supports two kinds of reusable blocks: functions (which return a value) and handlers (which perform an action).

Functions

Define a function with function ... end. Use return to send a value back.

example.bubble

Handlers

Handlers are defined with on ... end. They run statements but don’t return a value.

example.bubble

Recursion

Functions can call themselves. Classic examples:

Factorial

example.bubble

Fibonacci

example.bubble

Combining functions and handlers

Functions and handlers can call each other freely.

example.bubble