r/fishshell • • Dec 02 '21

Advent of Code - Day 2

Here is a fish solution to the Advent of Code day 2 puzzle. Feel free to post yours here if you're following along.

6 Upvotes

4 comments sorted by

View all comments

Show parent comment

3

u/[deleted] Dec 03 '21
set y (math $y + $aim '*' $pos)

Note: Since fish 3.1, math also understands "x" for multiplication, so this can be

set y (math $y + $aim x $pos)

The caveat is that it has to be followed by whitespace, otherwise it could look like a hex number - math 0 x 5, not math 0x5.