hit counter

Timeline

My development logbook

Swift Ternanry Operator ?

This will cause a compiler error:

1
2
3
4
let a=3
let b=4
 
let max = (a>b)? a:b // Compiler Error: Consecutive statements on a line must be separated by ';'"

Putting spaces around operators will resolve the compiler error i.e.

let max = a > b ? a : b