About 5,030,000 results
Open links in new tab
  1. How do I use the conditional (ternary) operator? - Stack Overflow

    It's most commonly used in assignment operations, although it has other uses as well. The ternary operator ? is a way of shortening an if-else clause, and is also called an immediate-if …

  2. How do you use the ? : (conditional) operator in JavaScript?

    Jun 7, 2011 · Actually ternary is the type of operator (i.e. it has 3 parts). The name of that specific ternary operator is the conditional operator. There just happens to only be one ternary …

  3. Is there a conditional ternary operator in VB.NET?

    Mar 28, 2018 · A ternary operator is any operator that takes three operands, much like a binary operator takes two and a unary operator takes one. The ?: operator is a specific example of a …

  4. Ternary operator in PowerShell - Stack Overflow

    Jul 10, 2015 · @Damien_The_Unbeliever That's technically true, but it's often called ternary operator. "Since this operator is often the only existing ternary operator in the language, it is …

  5. Does Python have a ternary conditional operator?

    Dec 27, 2008 · 3- Ternary operator can be written as nested if-else: # Python program to demonstrate nested ternary operator a, b = 10, 20 print ("Both a and b are equal" if a == b else …

  6. Ternary Operator evaluating wrongly? - Stack Overflow

    Nov 14, 2024 · However, my ternary operator seems to be behaving weirdly based on the following scenarios I have tested. The code underlying my investigations/scenarios is always …

  7. TCL conditional commands using ternary operator

    Mar 13, 2016 · For ternary conditions, we should be using boolean values only, either 0 or 1. So, you can't use string index directly, since it will return either a char or empty string. You have to …

  8. Benefits of using the conditional ?: (ternary) operator

    I would avoid using the ternary operator in situations that require if/else if/else, nested if/else, or if/else branch logic that results in the evaluation of multiple lines. Applying the ternary operator …

  9. JavaScript ternary operator example with functions

    The ternary operator is common when you're assigning a value to a variable based on a simple condition or you are making multiple decisions with very brief outcomes. The example you cite …

  10. Using the ternary operator for multiple operations

    Mar 8, 2012 · The conditional operator, which is a ternary operator (not a unary operator), is not a replacement for an if statement. It is an operator that returns one of two results. While you can …