Extra fixes
This commit is contained in:
parent
af85ce39cb
commit
048fa6c9cf
@ -62,6 +62,8 @@ fn [cc(.c)] main [export] () s32 {
|
|||||||
|
|
||||||
## Conditionals
|
## Conditionals
|
||||||
|
|
||||||
|
Here is how conditionals work, both with integers (which act as booleans) and pointers:
|
||||||
|
|
||||||
```nat {filename="main.nat"}
|
```nat {filename="main.nat"}
|
||||||
module std;
|
module std;
|
||||||
|
|
||||||
@ -77,9 +79,12 @@ fn [cc(.c)] main [export] () s32 {
|
|||||||
// With pointers
|
// With pointers
|
||||||
>pointer: ?*u32 = a.&;
|
>pointer: ?*u32 = a.&;
|
||||||
if (?pointer) {
|
if (?pointer) {
|
||||||
// Here the variable is shadowed, the attribute "non-null" is added to the backend to the pointer variable
|
// Here the variable is shadowed for this scope.
|
||||||
|
// The attribute "non-null" is added to the backend to the pointer variable
|
||||||
} else {
|
} else {
|
||||||
// Here the pointer is null
|
// Here the pointer is null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user