concept expression in category coffeescript

This is an excerpt from Manning's book CoffeeScript in Action.
How might CoffeeScript help? By simplifying JavaScript syntax and making each line easier to comprehend. That simplicity of expression will encourage you to compose programs that are, in turn, simpler and easier to comprehend. Your programs will become less complicated and not so intertwined. Simplifying small things, like syntax, can lead to simpler big things, like programs. Although it’s not a panacea (it’s possible to write incomprehensible garbage in CoffeeScript), learning CoffeeScript will help you to write better programs. It’s time to get started, time to write some CoffeeScript.
An expression is something that can be evaluated. An expression has a value. Almost everything in CoffeeScript is an expression. CoffeeScript even goes to some effort to make some things expressions that aren’t expressions in the underlying JavaScript. This emphasis on expressions means that they’re a good place to start exploring the syntax of CoffeeScript—starting with small expressions and moving on to larger ones.
Things that are only statements in JavaScript can be used as expressions in CoffeeScript. An example of this is the if statement, as shown by figure 2.2.
In JavaScript an if-else block like this can’t be used as an expression. In CoffeeScript it can be.
These are provided by the switch and when keywords, with the default option using the else keyword. Use them when you want different things to be evaluated depending on the value of an expression. The switch is often a good replacement for multiple if, else blocks:
connectJackNumber = (number) -> "Connecting jack #{number}" receiver = 'Betty' switch receiver when 'Betty' connectJackNumber 4 when 'Sandra' connectJackNumber 22 when 'Toby' connectJackNumber 9 else 'I am sorry, your call cannot be connected' # 'Connecting jack 4'You can use a switch block in an expression in the same way you can use an if block in an expression:
An inline then is useful when the expression is small: