Skip to content

Commit

Permalink
Merge pull request #93 from KorryKatti/patch-1
Browse files Browse the repository at this point in the history
Fix Utf8View example: semicolon and return value
  • Loading branch information
pedropark99 authored Nov 17, 2024
2 parents d8c514b + 10f9c4d commit d74e494
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Chapters/01-zig-weird.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -1300,18 +1300,18 @@ character/unicode point in this string:
#| eval: false
const std = @import("std");
const stdout = std.io.getStdOut().writer();
pub fn main() !void {
var utf8 = (
(try std.unicode.Utf8View.init("アメリカ"))
.iterator()
);
while (utf8.nextCodepointSlice()) |codepoint| {
var utf8 = try std.unicode.Utf8View.init("アメリカ");
var iterator = utf8.iterator();
while (iterator.nextCodepointSlice()) |codepoint| {
try stdout.print(
"got codepoint {}\n",
.{std.fmt.fmtSliceHexUpper(codepoint)}
.{std.fmt.fmtSliceHexUpper(codepoint)},
);
}
}
```

```
Expand Down

0 comments on commit d74e494

Please # to comment.