let len = try Option<u32> {
_a = readline()!
_a.length()
}
try _ {
}
try () {
}
catch {
}
try Option<T> {
}
trait Biased {
function biased(self): bool;
}
extend<T> Option<T>: Biased {
function biased(self) = @matches(self, Some(_))
}
extend<T> Result<T>: Biased {
function biased(self) = @matches(self, Success(_))
}
match a {
[ ]:
fallthrough
}
|a| {}
namespace legion;
function fibonacci() -> Iterator<Integer> {
let mut a = 0;
let mut b = 1;
while true {
yield b
b = b + a
a = b - a
}
}
self.word ?= b"Hello, World!"
extends<T, E> Result<T, E>: Perform {
perform(self) -> T / E {
match self {
Success(s) => s
Failure(e) => raise e
}
}
}
extends<T> Option<T>: Perform {
perform(self) -> T / null {
match self {
Some(s) => s
None => raise null
}
}
}
cases A(type) {
case A;
case B;
}
try Option[u64] {
}
.match {
with []
case Some(a):
print("Caught some")
when null || A:
print("Caught null")
}
.match {
case Some(a) && a > 0:
print("a > 0")
case a < 0:
print("a < 0")
case _:
print("a == 0")
}
which {
case a @ Some(a) if a > 0:
print(1)
case a < 0:
print(-1)
case _: print(0)
}
if case Some(a) = b {
print(1)
}
else if a < 0 {
print(-1)
}
else {
print(0)
}
function main() {
for i in fibonacci() {
if (i > 10) {
break;
}
print(i)
}
}
~~
#mut #async
function function() {
return 1;
}
function function_cps(async) {
return async(1);
}
#async {
}
function sum3(tensor1, tensor2, tensor3) : Iterator⟨Integer⟩ {
for i1 in tensor1 {
for i2, mut j2 in tensor2 {
for i3, mut j3, ref k3 in tensor3 {
yield i1 + i2 + i3;
}
}
}
}