While learning more and more Rust one little tidbit I learned today: Unlike JavaScript Rust doesn't have truthy or falsy values and no automatic conversion from non-boolean types to booleans. So if the condition in an if expression is not a boolean, you get a compilation error.

It's not a big deal, but it's something I like about Rust.

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help