Swift心得笔记之函数


参数

外部变量名

一般情况下你可以不指定外部变量名,直接调用函数:

http://why/233;param?foo=1&baa=2#fragment")
switch (urlComponents.host, urlComponents.path) {
case let (.Some(host), .Some(path)):
    println("host \(host) and path \(path)")
case let (.Some(host), .None):
    println("only host \(host)")
case let (.None, .Some(path)):
    println("only path \(path)")
case let (.None, .None):
    println("This is not a url!")
}
// "host why and path /233/param"

以上所述就是本文的全部内容了,希望大家能够喜欢。


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3