Can any one help me out ?Explain on ternary operator and how to use ternary operator in visual force page.Any Example .Any suggestion .Plz

closed as too broad by Chris Duncombe, Sergej Utko, Jenny B, dphil, Mohith Shrivastava Mar 24 '15 at 20:33

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Could you get more information for your question? At the moment it is not clear what is the problem you are facing. – Sergej Utko Mar 24 '15 at 12:29
  • 1
    where exactly you want to use this ? in any specific attribute or in javascript ? – Vamsi Krishna Mar 24 '15 at 12:29

I think there is no use case in Visualforce where it could be possible to use a ternary operator (at least all my attempts returned Error: Syntax error).

What you may want to use is an IF Function:

IF(logical_test, value_if_true, value_if_false)


{!IF(someVariable == 'OK', 'it is ok', 'not ok')}
  • 1
    I'd go so far as to say that the IF statement is a ternary operator, as it always requires three parameters, and the two branches must return compatible data types in at least most cases, making it identical in behavior with only a 4 character "penalty" over a ?: operator. – sfdcfox Mar 24 '15 at 13:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.