-
Notifications
You must be signed in to change notification settings - Fork 0
/
fizz-buzz.y2k
38 lines (33 loc) · 1.48 KB
/
fizz-buzz.y2k
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
29
30
31
32
33
34
35
36
37
38
# fizz-buzz.y2k
# This program loops through all numbers from 1-100. If the number is
# divisible by 3, it prints "fizz". If it's divisible by 5, it prints
# "buzz". If it's divisible by both 3 and 5, it prints "fizzbuzz". If
# none of those conditions are met, it just prints the number.
502 # Change interpreter to 2-digit parsing mode
# Set variables 9 and 8 to "fizz" and "buzz" respectively
08 09 01 04 # Create variable 9 with type string (1) and length 4
32 09 26 26 # Insert 4 chars ("Fizz") into variable 9
08 08 01 04 # Create variable 8 with type string (1) and length 4
28 21 26 26 # Insert 4 chars ("Buzz") into variable 8
05 00 01 # Change interpreter back to 1-digit parsing mode
# Set variable 7 to "fizzbuzz"
8791 # Create variable 7 with type "copy" (9) and length 1 (variable ID length)
9 # Use 1 digit variable ID (9) to copy values from var 9 to var 7
77111 # On variable 7, call function "+=" (5) using a variable (1) with a 1 digit ID
8 # Use 1 digit variable ID (8) to append values from var 8 to var 7
# Begin the loop from 0 to 100
61213100 # while variable 1 < 100 (implicit creation of var 1)
711011 # var 1 += 1
6140215 # if var 1 % 15 == 0
9217 # print var 7 ("fizzbuzz")
4 # continue
2000 # end-if
614013 # if var 1 % 3 == 0
9219 # print var 9 ("fizz")
4 # continue
2000 # end-if
614015 # if var 1 % 5 == 0
9218 # print var 8 ("buzz")
4 # continue
2000 # end-if
9211 # print var 1