mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
Merge pull request #25903 from aznashwan/minor-docs-fixes
docs: minor fixes to main language reference page.
This commit is contained in:
commit
d828115dab
@ -421,8 +421,7 @@
|
|||||||
{#code|unattached_doc-comment.zig#}
|
{#code|unattached_doc-comment.zig#}
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Doc comments can be interleaved with normal comments. Currently, when producing
|
Doc comments can be interleaved with normal comments, which are ignored.
|
||||||
the package documentation, normal comments are merged with doc comments.
|
|
||||||
</p>
|
</p>
|
||||||
{#header_close#}
|
{#header_close#}
|
||||||
{#header_open|Top-Level Doc Comments#}
|
{#header_open|Top-Level Doc Comments#}
|
||||||
|
|||||||
@ -4,6 +4,11 @@ const std = @import("std");
|
|||||||
const os = std.os;
|
const os = std.os;
|
||||||
const assert = std.debug.assert;
|
const assert = std.debug.assert;
|
||||||
|
|
||||||
|
// Custom error set definition:
|
||||||
|
const ExampleErrorSet = error{
|
||||||
|
ExampleErrorVariant,
|
||||||
|
};
|
||||||
|
|
||||||
pub fn main() void {
|
pub fn main() void {
|
||||||
// integers
|
// integers
|
||||||
const one_plus_one: i32 = 1 + 1;
|
const one_plus_one: i32 = 1 + 1;
|
||||||
@ -36,7 +41,7 @@ pub fn main() void {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// error union
|
// error union
|
||||||
var number_or_error: anyerror!i32 = error.ArgNotFound;
|
var number_or_error: ExampleErrorSet!i32 = ExampleErrorSet.ExampleErrorVariant;
|
||||||
|
|
||||||
print("\nerror union 1\ntype: {}\nvalue: {!}\n", .{
|
print("\nerror union 1\ntype: {}\nvalue: {!}\n", .{
|
||||||
@TypeOf(number_or_error),
|
@TypeOf(number_or_error),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user