Avatar
Avatar
treastrain / Tanaka.R
@swift-5.9.2 let flag = Bool.random() let num1 = if flag { 1.0 } else { 0.5 } let num2 = flag ? 1.0 : 0.5 let num3 = flag ? 1.0 : if flag { 1.0 } else { 0.5 }
swift59 BOT 6/4/2023 4:07 PM
exit status: 1 with <stdin>:5:25: error: 'if' may only be used as expression in return, throw, or as the source of an assignment let num3 = flag ? 1.0 : if flag { 1.0 } else { 0.5 } ^