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.

Swift日記(8日目)

Last updated at Posted at 2020-07-20

今日やったこと

  • 用語の勉強

FizzBuzzやった

FizzBuzz.swift
import UIKit
func printfizzbuzz(fizz_value:Int){
    for i in 1...fizz_value{
        if i % 15 == 0 {
            print("FizzBuzz")
        }else if i % 3 == 0  {
            print("Fizz")
        }else if i % 5 == 0 {
            print("Buzz")
        }else{
            print(i)
        }
    }
}

printfizzbuzz(fizz_value: 100)

クラス・関数・変数

  • 関数
  • 実行する命令のかたまり、のようなもの。中でいろんな処理をしてくれる
  • 変数
  • 様々なものを入れておく入れ物。中身を一定のルールで変えることができる。中身を変えることができない入れ物を定数という。
  • クラス
  • 関数と変数をまとめた集まり。
  • クラスの中にある変数をプロパティ、関数をメソッドと呼ぶ。なぜぇ。。。
  • クラスの中でプロパティやメソッドが働いてできあがった変数をインスタンスという。

変数一個に2種類も呼び方あるの納得いかねぇ。。。

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?