LoginSignup
1
1

More than 5 years have passed since last update.

Type annotation missing in pattern

Posted at
class weakTest {
    private let id //Type annotation missing in pattern
    //private let id: Int

    init(id: Int) {
        self.id = id

        print("called initializer")
    }
}

🍄解説🍄
変数宣言時に初期値を与えると型を省略できます。(型推論)
初期値を与えない場合は、型を指定しないとType annotation missing in patternが発生します。

1
1
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
1
1