switch 22 [
11 [print "here"]
22 [print "there"]
]
Red [title: "AOC Day 2"]
file: split trim/lines read %instructions #" "
aim: 0
horizontal: 0
depth: 0
depth2: 0
foreach [cmd arg] file [
arg: to-float arg
switch cmd [
"forward" [
horizontal: horizontal + arg
depth2: depth2 + (aim * arg)
]
"up" [
depth: depth - arg
aim: aim - arg
]
"down" [
depth: depth + arg
aim: aim + arg
]
]
]
print append "The first answer is: " horizontal * depth
print append "The second answer is: " horizontal * depth2
(edited)