From: acevest Date: Mon, 12 Jan 2015 02:43:06 +0000 (+0800) Subject: ... X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=883c430b9d5f53eaa39b3a6958d8046f1138519a;p=acecode.git ... --- diff --git a/learn/go/hello/array.go b/learn/go/hello/array.go index 11e9841..ef03af9 100644 --- a/learn/go/hello/array.go +++ b/learn/go/hello/array.go @@ -26,4 +26,8 @@ func main() { for i := 0; i < len(e); i++ { fmt.Println(e[i]) } + + for i, v := range d { + fmt.Println(i, v) + } } diff --git a/learn/go/hello/struct.go b/learn/go/hello/struct.1.go similarity index 100% rename from learn/go/hello/struct.go rename to learn/go/hello/struct.1.go diff --git a/learn/go/hello/switch.go b/learn/go/hello/switch.1.go similarity index 100% rename from learn/go/hello/switch.go rename to learn/go/hello/switch.1.go diff --git a/learn/swift/MyPlayground.playground/contents.xcplayground b/learn/swift/MyPlayground.playground/contents.xcplayground new file mode 100644 index 0000000..8e39341 --- /dev/null +++ b/learn/swift/MyPlayground.playground/contents.xcplayground @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/learn/swift/MyPlayground.playground/section-1.swift b/learn/swift/MyPlayground.playground/section-1.swift new file mode 100644 index 0000000..56326af --- /dev/null +++ b/learn/swift/MyPlayground.playground/section-1.swift @@ -0,0 +1,66 @@ +// Playground - noun: a place where people can play + +import UIKit + +var str = "Hello, playground" +println(str) + +let Constant = 0x1234 // let 声明常量 +var Variable = 0xAFEC // var 声明变量 +var VarInt = 8421 +var VarFloat = 3.1415926 +var VarDouble:Double = 2.71828182846 //如果初始类型信息不足,可以在变量后加":类型" +var VarF:Float = 0.1314 + + +let s = str + String(Variable) // 类型必需显示转换 + + +// 可以通过在客串中加\()的方式把值转换成字符串 +let Int2Str = "translate int in string with \(VarInt) \(str)" +println(Int2Str) + + +// 数组 +var arrayList = ["apple", "microsoft", "xx", "google", "tencent", "twitter"] +arrayList[2] = "amazon" +println(arrayList) + +// 字典 +var dict = [ + "apple" : "USA", + "tencnet" : "CN" +] +println(dict) + + +// 创建空数组和空字典 +var EmptyArray = [String]() +var EmptyDict = [String:String]() +// or +var EmptArrayWithNoType = [] +var EmptDictWithNoType = [:] + +for cp in arrayList { + println(cp) +} + + + +var OptionalVar: String? = "hehe" +OptionalVar == nil +if let name = OptionalVar { + println("Hello \(OptionalVar)") +} +else +{ + println("sssssss") +} + + +let word = "red apple" + +switch word { +case "dd" : +} + diff --git a/learn/swift/MyPlayground.playground/timeline.xctimeline b/learn/swift/MyPlayground.playground/timeline.xctimeline new file mode 100644 index 0000000..bf468af --- /dev/null +++ b/learn/swift/MyPlayground.playground/timeline.xctimeline @@ -0,0 +1,6 @@ + + + + +