15
2

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.

最近は気付いたら投稿しているらしい

import Foundation

enum Friends {
    case wai
    case sugoi
    case tanoshii
    case skill(String)
    func message() -> String {
        switch self {
        case .wai:
            return "わーい"
        case .sugoi:
            return "すごーい"
        case .tanoshii:
            return "たのしー"
        case .skill(let skill):
            return "君は\(skill)がとくいな、フレンズなんだね!!"
        }
    }
}

print([Friends.wai, Friends.sugoi, Friends.tanoshii, Friends.skill("クソリプ")].map({ $0.message() }).joined(separator: "\n"))

/*
わーい
すごーい
たのしー
君はクソリプがとくいな、フレンズなんだね!!
 */

元ネタ

PHP: http://qiita.com/t_ishida/items/bae7e62950d81f427f13
Scala: http://qiita.com/YukiAsu/items/d75b5e16f641c9d4bbf2
Golang: http://qiita.com/sakajunquality/items/5c4a2dc6967e584193ad
Ruby: http://qiita.com/844196/items/debc0cd1d39a6c3e32c7
Python: http://qiita.com/Nao-Y/items/f544a96cbd09b135c7e7
Bash: http://qiita.com/fk_2000/items/afd5f4ca8f5bb25011c7
Java: http://qiita.com/hanakayui0628/items/97242465693bda8cacd2

15
2
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
15
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?