Update.
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "scheduler" for Scheduler, Future
|
||||
|
||||
var isPositive = async { |x| x > 0 }
|
||||
var getValue = async { |x| x }
|
||||
|
||||
if (await isPositive(5)) {
|
||||
System.print("positive") // expect: positive
|
||||
}
|
||||
|
||||
if (await isPositive(-5)) {
|
||||
System.print("unreachable")
|
||||
} else {
|
||||
System.print("negative") // expect: negative
|
||||
}
|
||||
|
||||
var result = await isPositive(10) ? "yes" : "no"
|
||||
System.print(result) // expect: yes
|
||||
|
||||
while (await getValue(false)) {
|
||||
System.print("unreachable")
|
||||
}
|
||||
System.print("after while") // expect: after while
|
||||
Reference in New Issue
Block a user