Replace a while loop with recursion.

Every var should be considered a candidate for conversion to a val.
Every iterative loop is suspect, and vars and loops can be replaced
with vals and recursion.

This version of the code gives an intent-revealing name to what
the function does, and it uses recursion to substitute for looping.
Each skipped iteration is replaced with a recursive call with
i + 1 as the argument, effectively skipping to the next integer.

Once people can get their minds wrapped around recursion, they'll
find this style of coding easier to understand.
Add an example of breaks in Scala if you really need them.

You can exit to an enclosing block that's marked with breakable
with the break method offered by scala.control.util.Breaks.

The Breaks class implements break by throwing an exception that is
caught by an enclosing application of the breakable method.
Therefore, the call to break does not need to be in the same
method as the call to breakable.
Add a function that prints multiplication tables in an imperative style.
Refactor the multiplication table code to be more functional.
Add an application that finds long lines in text files.

The application expects the line width as the first argument, and
interprets subsequent arguments as filenames.

Yes, there's no error-checking on empty argument lists.
Move private helper method processLine to be local to processLine.
Remove unnecessary parameters from the local function, processLine.

Helper functions can access the parameters of their enclosing functions.
Add some examples of function literals.
Function literals can be shortened when applied to a collection.

Obviously, the parameters must match the type of the collection's
elements - Scala lets you leave out such redundant information and
write function literals more briefly.

This is called target typing, because the targeted usage of an
expression - in this case an argument to numbers.filter() - is
allowed to influence the typing of that expression - in this case
to determine the type of the x parameter.

You can simply start by writing a function literal without the
argument type, and, if the compiler gets confused,
add in the type. With time you'll develop a sense for which
situations the compiler can or can't puzzle out.
Remove parentheses from inferred-type lambda parameters.

If the type is inferred, you don't need to use parentheses.