MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerAnimemes/comments/13nc6fz/ternary_operator/jn0asu0/?context=3
r/ProgrammerAnimemes • u/bucket3432 • May 20 '23
41 comments sorted by
View all comments
Show parent comment
1
Rust, is that? Yeah, it would be nice if other languages supported something like that... which apparently PHP has since version 8?!
$a = 2; return match ($a) { 1 => "one", 2 => "two", 3 => "three", default => "other", };
On the JavaScript side, there's a Stage 1 proposal for a similar construct. I don't see that moving anytime soon.
2 u/Diapolo10 Jun 05 '23 Rust indeed! I'm quite fond of it, personally, even though I wouldn't say I'm particularly good at using it yet.
2
Rust indeed! I'm quite fond of it, personally, even though I wouldn't say I'm particularly good at using it yet.
View all comments
Show parent comment
1
u/bucket3432 Jun 05 '23
Rust, is that? Yeah, it would be nice if other languages supported something like that... which apparently PHP has since version 8?!
On the JavaScript side, there's a Stage 1 proposal for a similar construct. I don't see that moving anytime soon.