x = 0
x = 4 if a?
y = [10..1]
z =
a: 120
b: 10
c: 30
a = [
10
20
30
]
a = 1
x = 0
x = 10 if a?
a = 1
x = 0
x = 7 unless a?
z = 0
z ?= 10
class Vehicle
constructor: (@name)->
wheels: 0
howManyWheels: ->
alert "#{@name} has #{wheels} wheels."
class Bus extends Vehicle
wheels: 4
class Bicycle extends Vehicle
wheels: 2
We create these two instances:
redBus = new Bus "Red Bus"
blueBicycle = new Bicycle "Blue Bicycle"
redBus.howManyWheels()
blueBicycle.howManyWheels()
b = 10
a = if 3 > b then 10 else 100
[a, b, c] = [10, 30, 41]
x = ->
a = 10
b = 10 * a
c = a + b
[a, b, c]
o =
a: 20
b: 32
c: 87
d:
t: [
1, 0, 1
0, 1, 0
1, 0, 1
]
y: [
10
43
56
]
{d: {y: [z, x]}} = o