conditional within the if?

Asked

Viewed 30 times

1

I don’t know if I’m crazy kkkk but I think I remember seeing simple conditionals inside the printf. However, I don’t remember how it does. tipl, he does the same thing as this:

if (xxx)
    printf("xxx");
else 
    printf("YYY");

only everything in the same printf. It has as?

  • 1

    You have the IF INLINE operator, ex: printf( condicao ? "verdadeiro" : "falso" ) - Other languages have the if or iif function as equivalent: print( iif( x > 10, "v", "f" ) ) - The ? : is called "ternary" by a large majority. It is worth saying that it is not the best name for it, because "ternary" means that it has 3 "parts", but not necessarily every ternary in any language is conditional.

  • 1

    See if you’re looking for what’s in these links: https://answall.com/questions/92101/70 and https://answall.com/questions/10539/70 - if not, click [Edit] and provide more details than you need to know

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.