mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 05:10:55 +00:00
language: today, we killed lambdas
This commit is contained in:
@ -1,55 +0,0 @@
|
||||
export func main() {
|
||||
let three = 3
|
||||
let two = 2
|
||||
|
||||
let calculateSimple = { in
|
||||
(50 + three) * two
|
||||
}
|
||||
|
||||
let calculateComplex = { in
|
||||
three + two + 50
|
||||
}
|
||||
|
||||
let multiply = { a, b in
|
||||
a * b
|
||||
}
|
||||
|
||||
// calculates the result
|
||||
let calculateSimpleResult = calculateSimple()
|
||||
let calculateComplexResult = calculateComplex()
|
||||
let multiplyResult = multiply(50, 50)
|
||||
|
||||
let list = [10, 20, 30]
|
||||
let trueValue = true
|
||||
let falseValue = false
|
||||
|
||||
let invert = { value in
|
||||
!value
|
||||
}
|
||||
|
||||
let notEqual = { a, b in
|
||||
a != b
|
||||
}
|
||||
|
||||
let equal = { a, b in
|
||||
a == b
|
||||
}
|
||||
|
||||
let results = [
|
||||
calculateSimpleResult,
|
||||
calculateComplexResult,
|
||||
multiplyResult,
|
||||
list,
|
||||
trueValue,
|
||||
falseValue,
|
||||
invert(true),
|
||||
invert(false),
|
||||
equal(5, 5),
|
||||
equal(5, 6),
|
||||
notEqual(5, 5),
|
||||
notEqual(5, 6)
|
||||
]
|
||||
|
||||
println("results:")
|
||||
println(results)
|
||||
}
|
Reference in New Issue
Block a user