-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.modu
28 lines (28 loc) · 919 Bytes
/
lib.modu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
fn FredFinder(name, doPrint) { //if doPrint = true, will print the answer, if false will return.
if name == "Fred" {
if doPrint == true {
print("Your name is Fred! How cool!");
} //yeah i nest my code what are you gonna do about it
if doPrint == false {
return "Your name is Fred! How cool!";
}
}
if name != "Fred" {
if doPrint == true {
print("Your name is not Fred. How sad.");
}
if doPrint == false {
return "Your name is not Fred. How sad.";
}
}
}
fn HelloWorld() {
print("Hello World!");
}
fn loop(repeats, action) {
if repeats != 0 {
action();
let repeats = repeats - 1;
loop(repeats, action);
} //i was here before for loops were cool (or existed in modu at all)
} //DOES NOT WORK WITH RETURNS