java - what is this return method called? -


this question has answer here:

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

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -