ぜのぜ

しりとりしようぜのぜのぜのぜ

106日目

日記

今日書いたコード

func some() throws -> Int {
    3628800 / Int.random(in: 0...10)
}

func other() throws -> Int {
    120 / Int.random(in: 0...5)
}

try! some() + other()
try! (some() + other())
(try! some()) + (try! other())

func otherr() -> Int {
    120 / Int.random(in: 1...5)
}
try? some() + otherr()

感想

When the expression on the left-hand side of a binary operator is marked with try, try?, or try!, that operator applies to the whole binary expression. https://docs.swift.org/swift-book/ReferenceManual/Expressions.html