Swift inline conditional?

If you’re looking for a one-liner to do that, you can pull the ?: operation out of the string interpolation and concatenate with + instead:

let fileExists = false // for example
println("something " + (fileExists ? "exists" : "does not exist"))

Outputs:

something does not exist

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)