mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Working towards new versions of the examples.
This commit is contained in:
parent
c2da8c2d54
commit
13f6b037e2
4 changed files with 583 additions and 588 deletions
|
@ -128,10 +128,6 @@ activity = switch day
|
|||
# Semicolons can optionally be used instead of newlines.
|
||||
wednesday = -> eat_breakfast(); go_to_work(); eat_dinner()
|
||||
|
||||
# Array slice literals.
|
||||
zero_to_nine = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
three_to_six = zero_to_nine[3..6]
|
||||
|
||||
# Multiline strings with inner quotes.
|
||||
story = "Lorem ipsum dolor \"sit\" amet, consectetuer adipiscing elit,
|
||||
sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna
|
||||
|
|
|
@ -177,5 +177,5 @@ wipe_mutterings_from = (sentence) ->
|
|||
while sentence.indexOf('(') >= 0
|
||||
open = sentence.indexOf('(') - 1
|
||||
close = sentence.indexOf(')') + 1
|
||||
sentence = sentence[0..open] + sentence[close..sentence.length]
|
||||
sentence = sentence.slice(0, open) + sentence.slice(close, sentence.length)
|
||||
sentence
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# 5 times: "Odelay!" print.
|
||||
|
||||
print "Odelay!" for [1..5]
|
||||
print "Odelay!" for i from 1 to 5
|
||||
|
||||
|
||||
# add = (x, y): x + y.
|
||||
|
@ -166,7 +166,7 @@ while count > 0
|
|||
# 1 to 5 (a):
|
||||
# a string print.
|
||||
|
||||
print a for a in [1..5]
|
||||
print a for a from 1 to 5
|
||||
|
||||
|
||||
# if (3 ?gender):
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue