diff options
| author | Chris Boesch <chrboesch@noreply.codeberg.org> | 2026-04-03 19:32:53 +0200 |
|---|---|---|
| committer | Chris Boesch <chrboesch@noreply.codeberg.org> | 2026-04-03 19:32:53 +0200 |
| commit | 5307b2a338a92130bc498fb1dc7d21a9fd1b0db4 (patch) | |
| tree | 51279ca4fbd7bd90294dd563640c12a8c25c79c6 /exercises/089_async6.zig | |
| parent | 3056a2b5442f2f1ec58db3f3493109064ad2a2a5 (diff) | |
| parent | f6a6798c8b6b813bd2ceee81db276e05327a76e0 (diff) | |
Merge pull request 'revival of the async-io functions' (#383) from asyncIo into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/383
Diffstat (limited to 'exercises/089_async6.zig')
| -rw-r--r-- | exercises/089_async6.zig | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/exercises/089_async6.zig b/exercises/089_async6.zig deleted file mode 100644 index 8bf50e9..0000000 --- a/exercises/089_async6.zig +++ /dev/null @@ -1,54 +0,0 @@ -// -// The power and purpose of async/await becomes more apparent -// when we do multiple things concurrently. Foo and Bar do not -// depend on each other and can happen at the same time, but End -// requires that they both be finished. -// -// +---------+ -// | Start | -// +---------+ -// / \ -// / \ -// +---------+ +---------+ -// | Foo | | Bar | -// +---------+ +---------+ -// \ / -// \ / -// +---------+ -// | End | -// +---------+ -// -// We can express this in Zig like so: -// -// fn foo() u32 { ... } -// fn bar() u32 { ... } -// -// // Start -// -// var foo_frame = async foo(); -// var bar_frame = async bar(); -// -// var foo_value = await foo_frame; -// var bar_value = await bar_frame; -// -// // End -// -// Please await TWO page titles! -// -const print = @import("std").debug.print; - -pub fn main() void { - var com_frame = async getPageTitle("http://example.com"); - var org_frame = async getPageTitle("http://example.org"); - - var com_title = com_frame; - var org_title = org_frame; - - print(".com: {s}, .org: {s}.\n", .{ com_title, org_title }); -} - -fn getPageTitle(url: []const u8) []const u8 { - // Please PRETEND this is actually making a network request. - _ = url; - return "Example Title"; -} |
