摘自:stackoverflow.com/questions/24232799/why-choose-struct-over-class Structure instances are always passed by value, and class instances are always passed by reference. This means that they are suited to different kinds of tasks. As you consider the…
总是记不住向方法中传数组参数的语法,所以记录一下. func calculateStatistics(scores:[Int]) -> (min:Int,max:Int,sum:Int) { var min = scores[] var max = scores[] var sum = for score in scores { if score>max { max=score } else if score<min{ min=score } sum += score } return…