Error
Aborts the current call stack and prints an error message to Creator Tools.
fun error(_ message: String) -> ()
Example
// Returns the new balance after the withdraw
fun withdraw(_ amount: Int, balance: Int) -> (Int) {
if amount > balance {
error("cannot withdraw more than \{balance}")
}
// Not reached if error was called.
return balance - amount
}
var balance = withdraw(100, balance: 50)