前端之家收集整理的这篇文章主要介绍了
Swift基础篇——内外函数,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
import Foundation
func divisionOpertaion1(a: Double,b:Double) -> Double{
return a / b
}
func divisionOpertaion2(dividend: Double,divisor:Double) -> Double{
return dividend / divisor
}
func divisionOpertaion3(dividend a: Double,divisor b:Double) -> Double{
return a / b
}
print(divisionOpertaion3(dividend: 10,divisor: 3.5))
func divisionOpertaion4(a: Double,divisor b:Double) -> Double{
return a / b
}
print(divisionOpertaion4(3.5))
func divisionOpertaion5(dividend: Double,168)">return dividend / divisor
}
print(divisionOpertaion5(3.5))
func joinString(s1:String,toString s2:String,jioner s3:String) ->String
{
return s1 + s3 + s2;
}
func joinString2(s1:String,jioner s3:String = "❤️") ->String
{
return s1 + s3 + s2;
}
print(joinString2("hi",toString:"beauty"))
func joinString3(s1:String,jioner:String = return s1 + jioner + s2;
}
print(joinString3("beauty",jioner:"
原文链接:https://www.f2er.com/swift/325654.html