[Swift]参照渡し
参照渡し
class func addMonthWithYearMonth(inout ym:(year:Int,month:Int),addMonth:Int){ var y:Int = ym.year var m:Int = ym.month + addMonth while 12 < m { m -= 12 y++ } while m < 1 { m += 12 y-- } ym.year=y ym.month=m }
参照渡し
class func addMonthWithYearMonth(inout ym:(year:Int,month:Int),addMonth:Int){ var y:Int = ym.year var m:Int = ym.month + addMonth while 12 < m { m -= 12 y++ } while m < 1 { m += 12 y-- } ym.year=y ym.month=m }