pork/examples/syntax.pork

39 lines
612 B
Plaintext

/* main function */
main = { in
three = 3
two = 2
calculateSimple = { in
(50 + three) * two
}
calculateComplex = { in
three + two + 50
}
multiply = { a, b in
a * b
}
// calculates the result
calculateSimpleResult = calculateSimple()
calculateComplexResult = calculateComplex()
multiplyResult = multiply(50, 50)
list = [10, 20, 30]
trueValue = true
falseValue = false
invert = { value in
!value
}
[
calculateSimpleResult,
calculateComplexResult,
multiplyResult,
list,
trueValue,
falseValue,
invert(true),
invert(false)
]
}