Summary

  • The break expression causes a for, while, or loop expression to exit immediately

  • The continue expression causes for, while, and loop expressions to stop processing the current body, and continue with the next iteration

  • The return keyword causes a function to exit immediately

  • The return keyword can take a value to return from the function

  • If return is used without a value, it returns unit ()

  • The ? operator can be appended to any expression, and causes “None propagation”

  • The ? operator also works on other types, such as Result

  • The main function is allowed to return a Result, which can be used to indicate that a program failed

Get hands-on with 1400+ tech skills courses.