Boolean以外で条件判断しようとするとエラーになる。
let i = 1
if i {
// this example will not compile, and will report an error
}
比較演算子を使って条件判断するとコンパイルできる。
let i = 1
if i == 1 {
// this example will compile successfully
}
参考資料
* Booleans | The Swift Programming Language: The Basics
* The Swift Programming Language: Basic Operators