Return
The return
keyword is used to exit from a function or to return a value from a function (and exit it).
function isAdult (age : Int) : Bool { if(age < 18) { return false; } return true; }
This is a function that should help you understand how to use the return
keyword. It returns false
if the age is inferior to 18, or else it returns true
.