Summary

  • The if expression can be used to only perform an effect if a condition is true

  • An else branch can be added to an if to do something if the condition is false

  • You can build up more complex series of conditions with if/else if/else

  • If you provide an else, and all branches evaluate to the same type, you can evaluate to a value from your if expression

  • Functions can call themselves using recursion, which combined with conditionals, can allow for more sophisticated programs

  • Block-like expressions that evaluate to unit do not need a semicolon to be turned into statements