Worth More Than Cash

hypnagogic pacific reggae, gospel, bubblegum bass symphonic metal · 4:03

Listen on 93

Lyrics

[Verse 1]
When your function might just fail today
And errors could come out to play
Don't panic or let your program crash
There's a symbol that's worth more than cash

The question mark will save your code
When walking down that error road
It checks the result before you proceed
And gives you exactly what you need

[Chorus]
Question mark, question mark, handle with care
When something goes wrong, it's already there
Propagate up, let the caller decide
Question mark operator is your guide
Short and sweet, clean and bright
Question mark makes error handling right

[Verse 2]
When you open a file that might not exist
Or parse a string that could resist
Instead of crashing with a bang
Let question mark do its thing

If the result comes back okay
The value's yours to use today
But if an error's what you got
It bubbles up without a thought

[Chorus]
Question mark, question mark, handle with care
When something goes wrong, it's already there
Propagate up, let the caller decide
Question mark operator is your guide
Short and sweet, clean and bright
Question mark makes error handling right

[Bridge]
No more nested match statements deep
No more error checking that makes you weep
One little symbol does the work
Makes your error handling perk

Functions that return a Result type
Can use this pattern day and night
Early return when things go bad
Clean success paths make you glad

[Verse 3]
Remember that your function must
Return Result if you want to trust
The question mark to do its dance
Without it you won't get the chance

Chain them together, one by one
Each operation checks if done
The first error stops the line
And sends it up, works every time

[Chorus]
Question mark, question mark, handle with care
When something goes wrong, it's already there
Propagate up, let the caller decide
Question mark operator is your guide
Short and sweet, clean and bright
Question mark makes error handling right

[Outro]
So when you're coding in Rust today
And errors might get in your way
Remember the question mark's your friend
Clean error handling to the end

← Maybe Nothing's There to See | One Size Fits All →