0
1

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 3 years have passed since last update.

.distance(to: Int)について(Int型)  

Posted at

今回の内容

  • 今日、初めて.distance(to: Int)を知ったので、記録しておく為に書いてます。

コードと簡単解説

  • 対象のInt型の値に対して、.distance(to: Int)(to: Int)との差を取得してきます。
  • print結果に-7と表示された事を考えると、.distance(to: Int) - 対象のInt型のようになってる様です。
     let testInt = 10
        
     print(testInt.distance(to: 3))
     print(testInt.distance(to: 100))
print結果
     -7
     90

終わり

ご指摘、ご質問などありましたら、コメントまでお願い致します。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?