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