1. A variable declaration, unless you assign a value to the variable (e.g., val name =”Programming Scala”)
2. All method parameters (e.g., def deposit(amount: Money)…)
3. Method return values in the following cases:
- a. When you explicitly call return in a method (even at the end)
- b. When a method is recursive
- c. When a method is overloaded and one of the methods calls another; thecalling method needs a return type annotation
- d. When the inferred return type would be more general than you intended, e.g.,Any