Swift心得笔记之函数

内容摘要
参数
外部变量名
一般情况下你可以不指定外部变量名,直接调用函数:
http://why/233;param?foo=1&baa=2#fragment")

switch (urlComponents.host, urlComponents.path) {
文章正文

参数

外部变量名

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

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"

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


代码注释

作者:喵哥笔记

IDC笔记

学的不仅是技术,更是梦想!