Files
pork/examples/syntax.pork

39 lines
612 B
Plaintext
Raw Normal View History

2023-08-21 02:15:52 -07:00
/* main function */
2023-08-19 20:40:31 -07:00
main = { in
2023-08-19 15:29:07 -07:00
three = 3
two = 2
2023-08-19 20:40:31 -07:00
calculateSimple = { in
2023-08-19 15:29:07 -07:00
(50 + three) * two
}
2023-08-19 20:40:31 -07:00
calculateComplex = { in
2023-08-19 15:29:07 -07:00
three + two + 50
}
2023-08-19 20:40:31 -07:00
multiply = { a, b in
a * b
}
2023-08-21 02:22:43 -07:00
// calculates the result
2023-08-19 15:29:07 -07:00
calculateSimpleResult = calculateSimple()
calculateComplexResult = calculateComplex()
2023-08-19 20:40:31 -07:00
multiplyResult = multiply(50, 50)
2023-08-19 15:29:07 -07:00
list = [10, 20, 30]
trueValue = true
falseValue = false
2023-08-20 22:25:45 -07:00
invert = { value in
2023-08-20 22:35:07 -07:00
!value
2023-08-19 20:59:14 -07:00
}
2023-08-19 15:29:07 -07:00
[
calculateSimpleResult,
calculateComplexResult,
2023-08-19 20:40:31 -07:00
multiplyResult,
2023-08-19 15:29:07 -07:00
list,
trueValue,
2023-08-19 20:59:14 -07:00
falseValue,
2023-08-20 22:25:45 -07:00
invert(true),
invert(false)
2023-08-19 15:29:07 -07:00
]
}