diff options
| author | Vincenzo Palazzo <vincenzopalazzodev@gmail.com> | 2022-05-17 18:34:28 +0200 |
|---|---|---|
| committer | Vincenzo Palazzo <vincenzopalazzodev@gmail.com> | 2022-05-17 18:34:28 +0200 |
| commit | 8328f5ed51aee877dfc616be5d6fdcaa09becdca (patch) | |
| tree | 38e329522252d329e1b6688d1e0c76c83e53e45f /doc | |
| parent | f3517a1aa6058e9b09d57e81ecc81f27f086d163 (diff) | |
| download | zig-8328f5ed51aee877dfc616be5d6fdcaa09becdca.tar.gz zig-8328f5ed51aee877dfc616be5d6fdcaa09becdca.zip | |
docs: add documentation about return stm in the defer method
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/langref.html.in | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/langref.html.in b/doc/langref.html.in index 32320d5113..feee376e4e 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -4813,6 +4813,19 @@ fn deferErrorExample(is_error: bool) !void { print("encountered an error!\n", .{}); } + // inside a defer method the return statement + // is not allowed. + // The following lines produce the following + // error if uncomment + // ``` + // defer.zig:73:9: error: cannot return from defer expression + // return error.DeferError; + // ``` + // + //defer { + // return error.DeferError; + //} + if (is_error) { return error.DeferError; } |
