Initial Commit
This commit is contained in:
782 files changed
+145156
No files matched your search
@@ -0,0 +1,8 @@
|
||||
import std::io;
|
||||
def bumped(m: maybe<int>): int { return m is some(v) ? v + 1 : 0; }
|
||||
def doubled(m: maybe<int>): int { return m is not some(v) ? -1 : v * 2; }
|
||||
def main(): void {
|
||||
val none: maybe<int> = nothing {};
|
||||
val four: maybe<int> = maybe::<int>{ some = 4 };
|
||||
println($"{bumped(four)} {bumped(none)} {doubled(four)} {doubled(none)}");
|
||||
}
|
||||
Reference in new issue
Block a user