1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00
jashkenas--coffeescript/test/test_assignment.coffee

29 lines
440 B
CoffeeScript
Raw Normal View History

# 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
ok result is true and result2 is true
2010-01-17 10:40:59 -05:00
# Can assign a conditional statement.
get_x: -> 10
2010-01-17 10:40:59 -05:00
if x: get_x() then 100
ok x is 10
2010-01-17 10:40:59 -05:00
x: if get_x() then 100
ok x is 100
# This-assignment.
tester: ->
@example: -> puts 'example function'
this
ok tester().example.name is 'example'