java - what is this return method called? -
this question has answer here:
- java “? :” operator? [duplicate] 6 answers
i've come apon syntax few times in programming books , other open source programs i've been looking at.
return == null ? "": (string) am.get();
or
return level != 0 ? string.format("({0})", level) : "";
what pattern called? i've tried searching value ? value : value;
type pattern hoping come both here , on google, far no luck. think know it's doing love know call learn more.
that's "ternary operator," known "conditional operator": condition ? valueiftrue : valueiffalse
.
to knowledge there's no special name when it's used in return
statement.
Comments
Post a Comment