Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using the tenary operator in C with 3 numbers
#8
This one was fun...

Code: (Select All)
Age = 30

Beverage = Age >= 21 ? "Beer" : "Juice";

Results: Beer

So you don't assign beverage, it is determined by the assigned value of age.

Pete
Fake News + Phony Politicians = Real Problems

Reply


Messages In This Thread
RE: Using the tenary operator in C with 3 numbers - by Pete - 08-09-2024, 05:21 AM



Users browsing this thread: 19 Guest(s)