mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
15 lines
238 B
Zig
15 lines
238 B
Zig
|
const Foo = struct{};
|
||
|
fn doSomethingWithFoo(foo: *Foo) void { _ = foo; }
|
||
|
|
||
|
fn doAThing(optional_foo: ?*Foo) void {
|
||
|
// do some stuff
|
||
|
|
||
|
if (optional_foo) |foo| {
|
||
|
doSomethingWithFoo(foo);
|
||
|
}
|
||
|
|
||
|
// do some stuff
|
||
|
}
|
||
|
|
||
|
// syntax
|