mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-22 06:03:09 -05:00
Update 018_functions.zig
This commit is contained in:
parent
0603ab1e02
commit
d14cc0a8ab
1 changed files with 3 additions and 6 deletions
|
@ -1,18 +1,15 @@
|
||||||
//
|
//
|
||||||
// Functions! We've already created lots of functions called "main()". Now let's
|
// Functions! We've already created lots of functions called 'main()'. Now let's
|
||||||
// do something different:
|
// do something different:
|
||||||
//
|
//
|
||||||
// fn foo(n: u8) u8 {
|
// fn foo(n: u8) u8 {
|
||||||
// return n + 1;
|
// return n + 1;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// The foo() function above takes a number "n" and returns a number that is
|
// The foo() function above takes a number 'n' and returns a number that is
|
||||||
// larger by one.
|
// larger by one.
|
||||||
//
|
//
|
||||||
// If your function doesn't take any parameters and doesn't return anything,
|
// Note the input parameter 'n' and return types are both u8.
|
||||||
// it would be defined like main():
|
|
||||||
//
|
|
||||||
// fn foo() void { }
|
|
||||||
//
|
//
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue