pathway:
The code don't have seen,then search.
1. abs 返回数字的绝对值
数轴上的点到原点的距离叫做绝对值
abs(Int32) let number1 = abs(-12.4); let number2 = abs(-12); let number3 = abs(-13.0011 / 2); // print result: 12.4,12,6.50055
2. contains(sequence,element)
如果某个序列sequence(比如说一个数组)包含指定的元素element,则返回
true,否则返回false。
let languages = ["Swift","Objective-C"] let isInclude1 = languages.contains("Swift"); let isInclude2 = languages.contains("Java"); // print result : true false原文链接:https://www.f2er.com/swift/323269.html