Docs: Define functions used in loop examples (#4653)

* Cherrypick changes from messy branch

* Reorder function defs
This commit is contained in:
Ben Drechsel 2017-08-18 17:15:52 -07:00 committed by Geoffrey Booth
parent aef54aeaf7
commit 4623bf5bba
1 changed files with 2 additions and 0 deletions

View File

@ -1,8 +1,10 @@
# Eat lunch.
eat = (food) -> "#{food} eaten."
eat food for food in ['toast', 'cheese', 'wine']
# Fine five course dining.
courses = ['greens', 'caviar', 'truffles', 'roast', 'cake']
menu = (i, dish) -> "Menu Item #{i}: #{dish}"
menu i + 1, dish for dish, i in courses
# Health conscious meal.