This example in the book:
case hero.role
when 'captain'
div Yarr!
when 'hacker'
div w00t!
default
div Avast!
might be too simple for some beginners to make sense. This one should give you more context:
- for (var i in heroes) {
hero = heroes[i]
if hero.role == 'captain'
.msg Aye Captain!
else if hero.role == 'hacker' && hero.name != 'Napman'
.msg Who goes there?
else
.msg Avast!
- }