swift3.0输出有误为什么呢?
let point = (8,0)
switch point{
case (0,0):
print("It's oringin.")
fallthrough
case (_,0):
print("It's on the x-axis.")
fallthrough
case (0,_):
print("It's on the y-axis.")
default:
()
}
输出:
It's on the x-axis.
It's on the y-axis.
let point = (8,0)
switch point{
case (0,0):
print("It's oringin.")
fallthrough
case (_,0):
print("It's on the x-axis.")
fallthrough
case (0,_):
print("It's on the y-axis.")
default:
()
}
输出:
It's on the x-axis.
It's on the y-axis.
2016-09-18
不对啊 ,斯坦福老头讲的Calculator里一大堆赋值语句做条件的,比如:
let op1Evaluation = evaluate(remainingOps)
if let operand1 = op1Evaluation.result {
let op2Evaluation = evaluate(op1Evaluation.remainingOps)
}
}
let op1Evaluation = evaluate(remainingOps)
if let operand1 = op1Evaluation.result {
let op2Evaluation = evaluate(op1Evaluation.remainingOps)
}
}
2016-08-23
swift的字符串真是太方便了,真的很适合初学者。当初学编程的时候要是身边的同学都用这个,应该就没有那么多人放弃了
2016-08-22