mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Remove `[?]` syntax. - Change `int!` to `int?` syntax. - New `fault` declarations. - Enum associated values can reference the calling enum.
19 lines
255 B
Plaintext
19 lines
255 B
Plaintext
module unwrapping;
|
|
|
|
fn bool? get_bool()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
fn void bool_chain_unwrap() @test
|
|
{
|
|
bool b;
|
|
if (try v = get_bool() && b)
|
|
{
|
|
assert(v == true);
|
|
}
|
|
if (try v = get_bool() && v)
|
|
{
|
|
assert(v == true);
|
|
}
|
|
} |