mirror of
https://github.com/ziglang/zig.git
synced 2024-11-21 11:32:24 +00:00
langref: add try
, return
, break
, continue
to precedence table
This commit is contained in:
parent
ba1331090c
commit
875ae2e361
@ -1564,6 +1564,23 @@ const unwrapped = value catch 1234;
|
||||
unwrapped == 1234{#endsyntax#}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Forwarding Error Unwrap</td>
|
||||
<td><pre>{#syntax#}try a{#endsyntax#}</pre></td>
|
||||
<td>
|
||||
<ul>
|
||||
<li>{#link|Error Unions|Errors#}</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
Equivalent to:
|
||||
<pre>{#syntax#}a catch |err| return err{#endsyntax#}</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre>{#syntax#}const value: anyerror!u32 = 5678;
|
||||
(try value) == 5678{#endsyntax#}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Logical And</td>
|
||||
<td><pre>{#syntax#}a and b{#endsyntax#}</pre></td>
|
||||
@ -1845,7 +1862,7 @@ const B = error{Two};
|
||||
<pre>{#syntax#}x() x[] x.y x.* x.?
|
||||
a!b
|
||||
x{}
|
||||
!x -x -%x ~x &x ?x
|
||||
!x -x -%x ~x &x ?x try
|
||||
* / % ** *% *| ||
|
||||
+ - ++ +% -% +| -|
|
||||
<< >> <<|
|
||||
@ -1853,6 +1870,7 @@ x{}
|
||||
== != < > <= >=
|
||||
and
|
||||
or
|
||||
return break continue
|
||||
= *= *%= *|= /= %= += +%= +|= -= -%= -|= <<= <<|= >>= &= ^= |={#endsyntax#}</pre>
|
||||
{#header_close#}
|
||||
{#header_close#}
|
||||
|
Loading…
Reference in New Issue
Block a user