Showing posts with label one line if. Show all posts
Showing posts with label one line if. Show all posts

The Ternary Operator (?:)

One line if statement:


int x = 23;

int y = 45;

NSLog(@"Largest number is %i", x > y ? x : y );


// logs: Largest number is 45