This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Homebrew build logs for giginet/toybox/toybox on macOS 10.11.6 | |
| Build date: 2016-09-30 10:11:00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 依頼する | |
| class Game { | |
| // weakにするのは、依頼「する」側(デリゲート元)のプロパティ。 | |
| // される側(デリゲート先)が weakプロパティを持つと、得てして落ちるので注意 | |
| weak var delegate: GameDelegate? | |
| func start() { | |
| print("Number of players is \(delegate?.numberOfPlayers ?? 1)") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| import PlaygroundSupport | |
| PlaygroundPage.current.needsIndefiniteExecution = true | |
| let queue = DispatchQueue.global(qos: .userInitiated) | |
| queue.async { | |
| let isMainThread = Thread.isMainThread // false | |
| print("非同期の処理") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var first = 0 | |
| var second = 1 | |
| func fib() { | |
| for _ in 1...10 { | |
| print(first) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func selectionSort(array: [Int]) { | |
| var array = array | |
| var i = 0 | |
| // 要素数=7なら、6回走査すれば完了だよ。 | |
| while i < array.count-1 { | |
| var minIdx = i // 最初は0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // クラス内でなく、グローバルで宣言してもよい (ここの型、HogeじゃなくてSelfとかはできないよ) | |
| func == (lhs: Hoge, rhs: Hoge) -> Bool { | |
| return lhs.name == rhs.name | |
| } | |
| struct Hoge: Equatable { | |
| let name: String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var myStack = Stack<Int>() | |
| print("Input number of times that accepts command") | |
| let times = readLine().flatMap{ Int($0) }! | |
| print("1: push 2: pop 3: print max element") | |
| (1...times).forEach {_ in | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var letters = [String]() | |
| // 大文字: 65-90 | |
| // 小文字: 97-122 | |
| // ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] | |
| for i in 65...90 { | |
| let char = String(Character(UnicodeScalar(i)!)) | |
| letters.append(char) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (1...3).forEach { | |
| print($0) | |
| return | |
| print("ここもでるwww") | |
| print("ここはでないwww") | |
| } | |
| /* | |
| Result: |
OlderNewer