6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Booleanは`true`と`false`のみ

Posted at

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
}

参考資料

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?