Files
Toy/scripts/advent_1a.toy
Kayne Ruse 62ca7a1fb7 WIP: Implementing arrays into the script, read more
I had intended to solve the Advent of Code puzzles in Toy, but they
don't work without arrays. I wasn't able to enable arrays in time, so
I need to focus on doing things correctly.

The most immediate tasks are marked with 'URGENT', and a lot of tests
need writing.
2024-12-02 11:58:03 +11:00

28 lines
322 B
Plaintext

//advent of code thingy
var arr = [
3, 4,
4, 3,
2, 5,
1, 3,
3, 9,
3 , 3
];
var total = 0;
var counter = 0;
while (counter < arr.length) {
var difference = arr[counter] - arr[counter+1];
if (difference < 0) {
difference = -difference;
}
total += difference;
counter += 2;
}
print difference;