1
0
Fork 0
mirror of https://codeberg.org/ziglings/exercises.git synced 2025-06-08 01:57:02 +09:00

Replace vars with consts in async exercise patches

This commit is contained in:
Aurora 2024-07-05 14:24:47 +10:00
parent 7ab6692ebd
commit cb78dcd335
3 changed files with 8 additions and 8 deletions

View file

@ -4,8 +4,8 @@
pub fn main() void {
var myframe = async getPageTitle("http://example.com");
- var value = ???
+ var value = await myframe;
- const value = ???
+ const value = await myframe;
print("{s}\n", .{value});
}

View file

@ -4,10 +4,10 @@
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;
+ var com_title = await com_frame;
+ var org_title = await org_frame;
- const com_title = com_frame;
- const org_title = org_frame;
+ const com_title = await com_frame;
+ const org_title = await org_frame;
print(".com: {s}, .org: {s}.\n", .{ com_title, org_title });
}

View file

@ -4,8 +4,8 @@
// The main() function can not be async. But we know
// getBeef() will not suspend with this particular
// invocation. Please make this okay:
- var my_beef = getBeef(0);
+ var my_beef = nosuspend getBeef(0);
- const my_beef = getBeef(0);
+ const my_beef = nosuspend getBeef(0);
print("beef? {X}!\n", .{my_beef});
}