mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
- Remove `[?]` syntax. - Change `int!` to `int?` syntax. - New `fault` declarations. - Enum associated values can reference the calling enum.
34 lines
489 B
Plaintext
34 lines
489 B
Plaintext
module test;
|
|
|
|
fn void test1()
|
|
{
|
|
bool? x = false;
|
|
if (x) // #error: optional, but was 'bool?
|
|
{
|
|
x = 100;
|
|
}
|
|
}
|
|
|
|
fn void test2()
|
|
{
|
|
bool? x = false;
|
|
while (x) // #error: optional, but was 'bool?
|
|
{
|
|
x = false;
|
|
}
|
|
}
|
|
|
|
fn void test3()
|
|
{
|
|
bool? x = false;
|
|
double y = 1;
|
|
do
|
|
{
|
|
y = y + 1;
|
|
} while (y);
|
|
do
|
|
{
|
|
x = !x;
|
|
}
|
|
while (x); // #error: 'bool?' cannot be implicitly converted to a regular boolean value
|
|
} |