Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
chrismorgan
on Jan 13, 2014
|
parent
|
context
|
favorite
| on:
The State of Rust 0.9
Your ternary demo needs to be written thus for it to work:
let ter_demo = if a.is_none() { 3 } else { 2 };
You can also often use pattern matching:
let ter_demo = match a { None => 3, _ => 2 };
Ygg2
on Jan 13, 2014
[–]
Yeah, I wrote the example out of my head, so no surprises there. Thanks, though.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: