7 of 15
Types
Types are optional. When you add them, Pleno checks them as the program runs:
pleno
fn area(width: Float, height: Float): Float {
return width * height;
}
let label: String = "room";
let maybe: Int? = null; // Int or null
let id: Int | String = "user-7"; // either one
let tags: String[] = ["new"];RunA wrong value stops the program with a clear message instead of failing somewhere later. An Int is accepted where a Float is expected.
Your turn
Run the program and read the error. Then fix the call so the program finishes.