Dave’s Brain
Home
Search
Browse
Recent
Keywords
Other sites
Feedback
Sign in
Random
Crawlers
Programming Tips
- What is the Scala equivalent to the C question mark?
Date:
2013may14
Language:
Scala
Level:
Beginner
Q.
What is the Scala equivalent to the C question mark?
A.
In C:
return
a
>
b
?
a
:
b
// Return the max
In Scala:
return
if
(
a
>
b
)
a
else
b