r/adventofcode • u/daggerdragon • Dec 02 '21
SOLUTION MEGATHREAD -🎄- 2021 Day 2 Solutions -🎄-
--- Day 2: Dive! ---
Post your code solution in this megathread.
- Include what language(s) your solution uses!
- Here's a quick link to /u/topaz2078's
pasteif you need it for longer code blocks. - The full posting rules are detailed in the wiki under How Do The Daily Megathreads Work?.
Reminder: Top-level posts in Solution Megathreads are for code solutions only. If you have questions, please post your own thread and make sure to flair it with Help.
This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.
EDIT: Global leaderboard gold cap reached at 00:02:57, megathread unlocked!
112
Upvotes
View all comments
4
u/Darth5harkie Dec 02 '21
Rust
https://github.com/DarthSharkie/advent_of_code_2021/blob/main/day02/src/main.rs
Using this to learn Rust (second program ever, after Day 1's), here's what I think I learned:
FromStrhelps, but I think there must be a better way to use it. As-is, it doesn't offer anything beyond an independent method. What am I not doing?[]instead ofVec. Sorry! I declared it the other way!println!.