| ... | ... | @@ -10322,7 +10322,8 @@ fn readU32Be() u32 {} |
| 10322 | 10322 | <pre>{#syntax#}align{#endsyntax#}</pre> |
| 10323 | 10323 | </td> |
| 10324 | 10324 | <td> |
| 10325 | | {#syntax#}align{#endsyntax#} can be used to specify the alignment of a pointer. It can also be used after a variable or function declaration to specify the alignment of pointers to that variable or function. |
| 10325 | {#syntax#}align{#endsyntax#} can be used to specify the alignment of a pointer. |
| 10326 | It can also be used after a variable or function declaration to specify the alignment of pointers to that variable or function. |
| 10326 | 10327 | <ul> |
| 10327 | 10328 | <li>See also {#link|Alignment#}</li> |
| 10328 | 10329 | </ul> |
| ... | ... | @@ -10366,7 +10367,8 @@ fn readU32Be() u32 {} |
| 10366 | 10367 | <pre>{#syntax#}anytype{#endsyntax#}</pre> |
| 10367 | 10368 | </td> |
| 10368 | 10369 | <td> |
| 10369 | | Function parameters can be declared with {#syntax#}anytype{#endsyntax#} in place of the type. The parameter type will be inferred where the function is called. |
| 10370 | Function parameters and struct fields can be declared with {#syntax#}anytype{#endsyntax#} in place of the type. |
| 10371 | The type will be inferred where the function is called or the struct is instantiated. |
| 10370 | 10372 | <ul> |
| 10371 | 10373 | <li>See also {#link|Function Parameter Type Inference#}</li> |
| 10372 | 10374 | </ul> |
| ... | ... | @@ -10399,7 +10401,8 @@ fn readU32Be() u32 {} |
| 10399 | 10401 | <pre>{#syntax#}await{#endsyntax#}</pre> |
| 10400 | 10402 | </td> |
| 10401 | 10403 | <td> |
| 10402 | | {#syntax#}await{#endsyntax#} can be used to suspend the current function until the frame provided after the {#syntax#}await{#endsyntax#} completes. {#syntax#}await{#endsyntax#} copies the value returned from the target function's frame to the caller. |
| 10404 | {#syntax#}await{#endsyntax#} can be used to suspend the current function until the frame provided after the {#syntax#}await{#endsyntax#} completes. |
| 10405 | {#syntax#}await{#endsyntax#} copies the value returned from the target function's frame to the caller. |
| 10403 | 10406 | <ul> |
| 10404 | 10407 | <li>See also {#link|Async Functions#}</li> |
| 10405 | 10408 | </ul> |
| ... | ... | @@ -10410,8 +10413,8 @@ fn readU32Be() u32 {} |
| 10410 | 10413 | <pre>{#syntax#}break{#endsyntax#}</pre> |
| 10411 | 10414 | </td> |
| 10412 | 10415 | <td> |
| 10413 | | {#syntax#}break{#endsyntax#} can be used to exit a loop before iteration completes naturally. |
| 10414 | | It can also be used with a block label to return a value from the block. |
| 10416 | {#syntax#}break{#endsyntax#} can be used with a block label to return a value from the block. |
| 10417 | It can also be used to exit a loop before iteration completes naturally. |
| 10415 | 10418 | <ul> |
| 10416 | 10419 | <li>See also {#link|blocks#}, {#link|while#}, {#link|for#}</li> |
| 10417 | 10420 | </ul> |
| ... | ... | @@ -10422,7 +10425,8 @@ fn readU32Be() u32 {} |
| 10422 | 10425 | <pre>{#syntax#}catch{#endsyntax#}</pre> |
| 10423 | 10426 | </td> |
| 10424 | 10427 | <td> |
| 10425 | | {#syntax#}catch{#endsyntax#} can be used to provide a default value for an error union, or capture its error value in an expression. |
| 10428 | {#syntax#}catch{#endsyntax#} can be used to evaluate an expression if the expression before it evaluates to an error. |
| 10429 | The expression after the {#syntax#}catch{#endsyntax#} can optionally capture the error value. |
| 10426 | 10430 | <ul> |
| 10427 | 10431 | <li>See also {#link|catch#}, {#link|Operators#}</li> |
| 10428 | 10432 | </ul> |
| ... | ... | @@ -10446,6 +10450,7 @@ fn readU32Be() u32 {} |
| 10446 | 10450 | </td> |
| 10447 | 10451 | <td> |
| 10448 | 10452 | {#syntax#}const{#endsyntax#} declares a variable that can not be modified. |
| 10453 | Used as a pointer attribute, it denotes the value referenced by the pointer cannot be modified. |
| 10449 | 10454 | <ul> |
| 10450 | 10455 | <li>See also {#link|Variables#}</li> |
| 10451 | 10456 | </ul> |
| ... | ... | @@ -10467,7 +10472,7 @@ fn readU32Be() u32 {} |
| 10467 | 10472 | <pre>{#syntax#}defer{#endsyntax#}</pre> |
| 10468 | 10473 | </td> |
| 10469 | 10474 | <td> |
| 10470 | | {#syntax#}defer{#endsyntax#} will execute an expression at the end of the current block. |
| 10475 | {#syntax#}defer{#endsyntax#} will execute an expression when control flow leaves the current block. |
| 10471 | 10476 | <ul> |
| 10472 | 10477 | <li>See also {#link|defer#}</li> |
| 10473 | 10478 | </ul> |
| ... | ... | @@ -10478,7 +10483,8 @@ fn readU32Be() u32 {} |
| 10478 | 10483 | <pre>{#syntax#}else{#endsyntax#}</pre> |
| 10479 | 10484 | </td> |
| 10480 | 10485 | <td> |
| 10481 | | {#syntax#}else{#endsyntax#} can be used to provide an alternate branch for {#syntax#}if{#endsyntax#}, {#syntax#}switch{#endsyntax#}, {#syntax#}while{#endsyntax#}, and {#syntax#}for{#endsyntax#} expressions. |
| 10486 | {#syntax#}else{#endsyntax#} can be used to provide an alternate branch for {#syntax#}if{#endsyntax#}, {#syntax#}switch{#endsyntax#}, |
| 10487 | {#syntax#}while{#endsyntax#}, and {#syntax#}for{#endsyntax#} expressions. |
| 10482 | 10488 | <ul> |
| 10483 | 10489 | <li>If used after an if expression, the else branch will be executed if the test value returns false, null, or an error.</li> |
| 10484 | 10490 | <li>If used within a switch expression, the else branch will be executed if the test value matches no other cases.</li> |
| ... | ... | @@ -10492,7 +10498,7 @@ fn readU32Be() u32 {} |
| 10492 | 10498 | <pre>{#syntax#}enum{#endsyntax#}</pre> |
| 10493 | 10499 | </td> |
| 10494 | 10500 | <td> |
| 10495 | | {#syntax#}enum{#endsyntax#} defines an anonymous enum type. |
| 10501 | {#syntax#}enum{#endsyntax#} defines an enum type. |
| 10496 | 10502 | <ul> |
| 10497 | 10503 | <li>See also {#link|enum#}</li> |
| 10498 | 10504 | </ul> |
| ... | ... | @@ -10503,7 +10509,7 @@ fn readU32Be() u32 {} |
| 10503 | 10509 | <pre>{#syntax#}errdefer{#endsyntax#}</pre> |
| 10504 | 10510 | </td> |
| 10505 | 10511 | <td> |
| 10506 | | {#syntax#}errdefer{#endsyntax#} will execute an expression at the end of the current block if and only if the block returns an error. |
| 10512 | {#syntax#}errdefer{#endsyntax#} will execute an expression when control flow leaves the current block if the function returns an error. |
| 10507 | 10513 | <ul> |
| 10508 | 10514 | <li>See also {#link|errdefer#}</li> |
| 10509 | 10515 | </ul> |
| ... | ... | @@ -10514,7 +10520,7 @@ fn readU32Be() u32 {} |
| 10514 | 10520 | <pre>{#syntax#}error{#endsyntax#}</pre> |
| 10515 | 10521 | </td> |
| 10516 | 10522 | <td> |
| 10517 | | {#syntax#}error{#endsyntax#} defines an anonymous error type. |
| 10523 | {#syntax#}error{#endsyntax#} defines an error type. |
| 10518 | 10524 | <ul> |
| 10519 | 10525 | <li>See also {#link|Errors#}</li> |
| 10520 | 10526 | </ul> |
| ... | ... | @@ -10525,7 +10531,8 @@ fn readU32Be() u32 {} |
| 10525 | 10531 | <pre>{#syntax#}export{#endsyntax#}</pre> |
| 10526 | 10532 | </td> |
| 10527 | 10533 | <td> |
| 10528 | | {#syntax#}export{#endsyntax#} makes a function externally visible in the generated object file, and makes it use the C ABI. |
| 10534 | {#syntax#}export{#endsyntax#} makes a function or variable externally visible in the generated object file. |
| 10535 | Exported functions default to the C calling convention. |
| 10529 | 10536 | <ul> |
| 10530 | 10537 | <li>See also {#link|Functions#}</li> |
| 10531 | 10538 | </ul> |
| ... | ... | @@ -10536,7 +10543,8 @@ fn readU32Be() u32 {} |
| 10536 | 10543 | <pre>{#syntax#}extern{#endsyntax#}</pre> |
| 10537 | 10544 | </td> |
| 10538 | 10545 | <td> |
| 10539 | | {#syntax#}extern{#endsyntax#} can be used to declare a function that will be resolved at link time, when linking statically, or at runtime, when linking dynamically. |
| 10546 | {#syntax#}extern{#endsyntax#} can be used to declare a function or variable that will be resolved at link time, when linking statically |
| 10547 | or at runtime, when linking dynamically. |
| 10540 | 10548 | <ul> |
| 10541 | 10549 | <li>See also {#link|Functions#}</li> |
| 10542 | 10550 | </ul> |
| ... | ... | @@ -10569,7 +10577,7 @@ fn readU32Be() u32 {} |
| 10569 | 10577 | <pre>{#syntax#}for{#endsyntax#}</pre> |
| 10570 | 10578 | </td> |
| 10571 | 10579 | <td> |
| 10572 | | A {#syntax#}for{#endsyntax#} expression can be used to iterate over the elements of a slice or array. |
| 10580 | A {#syntax#}for{#endsyntax#} expression can be used to iterate over the elements of a slice, array, or tuple. |
| 10573 | 10581 | <ul> |
| 10574 | 10582 | <li>See also {#link|for#}</li> |
| 10575 | 10583 | </ul> |
| ... | ... | @@ -10648,7 +10656,7 @@ fn readU32Be() u32 {} |
| 10648 | 10656 | <pre>{#syntax#}orelse{#endsyntax#}</pre> |
| 10649 | 10657 | </td> |
| 10650 | 10658 | <td> |
| 10651 | | {#syntax#}orelse{#endsyntax#} can be used to provide a default value for an optional expression if it evaluates to null. |
| 10659 | {#syntax#}orelse{#endsyntax#} can be used to evaluate an expression if the expression before it evaluates to null. |
| 10652 | 10660 | <ul> |
| 10653 | 10661 | <li>See also {#link|Optionals#}, {#link|Operators#}</li> |
| 10654 | 10662 | </ul> |
| ... | ... | @@ -10659,7 +10667,8 @@ fn readU32Be() u32 {} |
| 10659 | 10667 | <pre>{#syntax#}packed{#endsyntax#}</pre> |
| 10660 | 10668 | </td> |
| 10661 | 10669 | <td> |
| 10662 | | The {#syntax#}packed{#endsyntax#} keyword before a struct definition changes the struct's in-memory layout to the guaranteed {#syntax#}packed{#endsyntax#} layout. |
| 10670 | The {#syntax#}packed{#endsyntax#} keyword before a struct definition changes the struct's in-memory layout |
| 10671 | to the guaranteed {#syntax#}packed{#endsyntax#} layout. |
| 10663 | 10672 | <ul> |
| 10664 | 10673 | <li>See also {#link|packed struct#}</li> |
| 10665 | 10674 | </ul> |
| ... | ... | @@ -10670,7 +10679,8 @@ fn readU32Be() u32 {} |
| 10670 | 10679 | <pre>{#syntax#}pub{#endsyntax#}</pre> |
| 10671 | 10680 | </td> |
| 10672 | 10681 | <td> |
| 10673 | | The {#syntax#}pub{#endsyntax#} in front of a top level declaration makes the declaration available to reference from a different file than the one it is declared in. |
| 10682 | The {#syntax#}pub{#endsyntax#} in front of a top level declaration makes the declaration available |
| 10683 | to reference from a different file than the one it is declared in. |
| 10674 | 10684 | <ul> |
| 10675 | 10685 | <li>See also {#link|import#}</li> |
| 10676 | 10686 | </ul> |
| ... | ... | @@ -10714,7 +10724,7 @@ fn readU32Be() u32 {} |
| 10714 | 10724 | <pre>{#syntax#}struct{#endsyntax#}</pre> |
| 10715 | 10725 | </td> |
| 10716 | 10726 | <td> |
| 10717 | | {#syntax#}struct{#endsyntax#} defines an anonymous struct. |
| 10727 | {#syntax#}struct{#endsyntax#} defines a struct. |
| 10718 | 10728 | <ul> |
| 10719 | 10729 | <li>See also {#link|struct#}</li> |
| 10720 | 10730 | </ul> |
| ... | ... | @@ -10726,7 +10736,8 @@ fn readU32Be() u32 {} |
| 10726 | 10736 | </td> |
| 10727 | 10737 | <td> |
| 10728 | 10738 | {#syntax#}suspend{#endsyntax#} will cause control flow to return to the call site or resumer of the function. |
| 10729 | | {#syntax#}suspend{#endsyntax#} can also be used before a block within a function, to allow the function access to it's frame before control flow returns to the call site. |
| 10739 | {#syntax#}suspend{#endsyntax#} can also be used before a block within a function, |
| 10740 | to allow the function access to its frame before control flow returns to the call site. |
| 10730 | 10741 | <ul> |
| 10731 | 10742 | <li>See also {#link|Suspend and Resume#}</li> |
| 10732 | 10743 | </ul> |
| ... | ... | @@ -10737,7 +10748,8 @@ fn readU32Be() u32 {} |
| 10737 | 10748 | <pre>{#syntax#}switch{#endsyntax#}</pre> |
| 10738 | 10749 | </td> |
| 10739 | 10750 | <td> |
| 10740 | | A {#syntax#}switch{#endsyntax#} expression can be used to test values of a common type. {#syntax#}switch{#endsyntax#} cases can capture field values of a {#link|Tagged union#}. |
| 10751 | A {#syntax#}switch{#endsyntax#} expression can be used to test values of a common type. |
| 10752 | {#syntax#}switch{#endsyntax#} cases can capture field values of a {#link|Tagged union#}. |
| 10741 | 10753 | <ul> |
| 10742 | 10754 | <li>See also {#link|switch#}</li> |
| 10743 | 10755 | </ul> |
| ... | ... | @@ -10748,7 +10760,8 @@ fn readU32Be() u32 {} |
| 10748 | 10760 | <pre>{#syntax#}test{#endsyntax#}</pre> |
| 10749 | 10761 | </td> |
| 10750 | 10762 | <td> |
| 10751 | | The {#syntax#}test{#endsyntax#} keyword can be used to denote a top-level block of code used to make sure behavior meets expectations. |
| 10763 | The {#syntax#}test{#endsyntax#} keyword can be used to denote a top-level block of code |
| 10764 | used to make sure behavior meets expectations. |
| 10752 | 10765 | <ul> |
| 10753 | 10766 | <li>See also {#link|Zig Test#}</li> |
| 10754 | 10767 | </ul> |
| ... | ... | @@ -10805,7 +10818,7 @@ fn readU32Be() u32 {} |
| 10805 | 10818 | <pre>{#syntax#}union{#endsyntax#}</pre> |
| 10806 | 10819 | </td> |
| 10807 | 10820 | <td> |
| 10808 | | {#syntax#}union{#endsyntax#} defines an anonymous union. |
| 10821 | {#syntax#}union{#endsyntax#} defines a union. |
| 10809 | 10822 | <ul> |
| 10810 | 10823 | <li>See also {#link|union#}</li> |
| 10811 | 10824 | </ul> |
| ... | ... | @@ -10816,6 +10829,7 @@ fn readU32Be() u32 {} |
| 10816 | 10829 | <pre>{#syntax#}unreachable{#endsyntax#}</pre> |
| 10817 | 10830 | </td> |
| 10818 | 10831 | <td> |
| 10832 | {#syntax#}unreachable{#endsyntax#} can be used to assert that control flow will never happen upon a particular location. |
| 10819 | 10833 | Depending on the build mode, {#syntax#}unreachable{#endsyntax#} may emit a panic. |
| 10820 | 10834 | <ul> |
| 10821 | 10835 | <li>Emits a panic in {#syntax#}Debug{#endsyntax#} and {#syntax#}ReleaseSafe{#endsyntax#} mode, or when using <code>zig test</code>.</li> |
| ... | ... | @@ -10829,7 +10843,8 @@ fn readU32Be() u32 {} |
| 10829 | 10843 | <pre>{#syntax#}usingnamespace{#endsyntax#}</pre> |
| 10830 | 10844 | </td> |
| 10831 | 10845 | <td> |
| 10832 | | {#syntax#}usingnamespace{#endsyntax#} is a top-level declaration that imports all the public declarations of the operand, which must be a struct, union, or enum, into the current scope. |
| 10846 | {#syntax#}usingnamespace{#endsyntax#} is a top-level declaration that imports all the public declarations of the operand, |
| 10847 | which must be a struct, union, or enum, into the current scope. |
| 10833 | 10848 | <ul> |
| 10834 | 10849 | <li>See also {#link|usingnamespace#}</li> |
| 10835 | 10850 | </ul> |
| ... | ... | @@ -10863,7 +10878,8 @@ fn readU32Be() u32 {} |
| 10863 | 10878 | <pre>{#syntax#}while{#endsyntax#}</pre> |
| 10864 | 10879 | </td> |
| 10865 | 10880 | <td> |
| 10866 | | A {#syntax#}while{#endsyntax#} expression can be used to repeatedly test a boolean, optional, or error union expression, and cease looping when that expression evaluates to false, null, or an error, respectively. |
| 10881 | A {#syntax#}while{#endsyntax#} expression can be used to repeatedly test a boolean, optional, or error union expression, |
| 10882 | and cease looping when that expression evaluates to false, null, or an error, respectively. |
| 10867 | 10883 | <ul> |
| 10868 | 10884 | <li>See also {#link|while#}</li> |
| 10869 | 10885 | </ul> |