pedropark99 / zig-book

An open, technical and introductory book for the Zig programming language
https://pedropark99.github.io/zig-book/
Other
590 stars 21 forks source link

Compare Zig defer with Go defer #54

Open pedropark99 opened 1 month ago

pedropark99 commented 1 month ago

The Go language have a defer keyword. However, the Go defer is different than Zig defer. Because Go defer is "move expression to function exit", while Zig defer is "move expression to current scope exit".

This difference have a slightly different effect.

https://go.dev/tour/flowcontrol/12