mirror of
https://codeberg.org/ziglings/exercises.git
synced 2025-06-08 01:57:02 +09:00
Update exercises/028_defer2.zig
This commit is contained in:
parent
7c50bd1e47
commit
ec654626dd
1 changed files with 4 additions and 0 deletions
|
@ -15,6 +15,10 @@ pub fn main() void {
|
|||
// This function is _supposed_ to print an animal name in parentheses
|
||||
// like "(Goat) ", but we somehow need to print the end parenthesis
|
||||
// even though this function can return in four different places!
|
||||
|
||||
// In zigling 027 runLater() is said to run when the block, within which runLater() is defined, has finished.
|
||||
// In zigling 028 the block seems to be the function printAnimal, within which the to be defered print function is formulated, but the defer runs after every if{} block;
|
||||
// Shoud the explantion in the comments of 027 be reformulated?
|
||||
fn printAnimal(animal: u8) void {
|
||||
std.debug.print("(", .{});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue