pork/examples/syntax.pork

37 lines
584 B
Plaintext
Raw Normal View History

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