2010-04-03 14:39:32 +00:00
|
|
|
# Can assign the result of a try/catch block.
|
2010-01-17 15:40:59 +00:00
|
|
|
result: try
|
|
|
|
nonexistent * missing
|
|
|
|
catch error
|
|
|
|
true
|
|
|
|
|
|
|
|
result2: try nonexistent * missing catch error then true
|
|
|
|
|
2010-04-03 14:39:32 +00:00
|
|
|
ok result is true and result2 is true
|
2010-01-17 15:40:59 +00:00
|
|
|
|
|
|
|
|
2010-04-03 14:39:32 +00:00
|
|
|
# Can assign a conditional statement.
|
2010-06-12 23:05:13 +00:00
|
|
|
getX: -> 10
|
2010-01-17 15:40:59 +00:00
|
|
|
|
2010-06-12 23:05:13 +00:00
|
|
|
if x: getX() then 100
|
2010-01-17 15:40:59 +00:00
|
|
|
|
2010-04-03 14:39:32 +00:00
|
|
|
ok x is 10
|
2010-01-17 15:40:59 +00:00
|
|
|
|
2010-06-12 23:05:13 +00:00
|
|
|
x: if getX() then 100
|
2010-01-17 15:40:59 +00:00
|
|
|
|
2010-04-03 14:39:32 +00:00
|
|
|
ok x is 100
|
2010-02-19 12:51:52 +00:00
|
|
|
|
2010-02-19 23:27:50 +00:00
|
|
|
|
2010-04-03 14:39:32 +00:00
|
|
|
# This-assignment.
|
2010-02-19 12:51:52 +00:00
|
|
|
tester: ->
|
2010-05-15 03:40:04 +00:00
|
|
|
@example: -> 'example function'
|
2010-02-19 12:51:52 +00:00
|
|
|
this
|
|
|
|
|
2010-05-15 03:40:04 +00:00
|
|
|
ok tester().example() is 'example function'
|