mirror of
https://codeberg.org/ziglings/exercises.git
synced 2025-06-08 01:57:02 +09:00
Replace var
s with const
s in async exercise patches
This commit is contained in:
parent
7ab6692ebd
commit
cb78dcd335
3 changed files with 8 additions and 8 deletions
|
@ -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});
|
||||
}
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
|
|
|
@ -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});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue