摘要:
//: Playground - noun: a place where people can play import UIKit // fallthrough // fallthrough会在当前case执行完之后继续下一个case // 如果在下一个case中声明了变量, 则不能使用fallth 阅读全文
posted @ 2015-12-16 17:44
Rinpe
阅读(462)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKit// 对区间进行判断var score = 90switch score {case 0: print("You got an egg!")case 1..是介绍运算... 阅读全文
posted @ 2015-12-16 16:44
Rinpe
阅读(530)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKitvar rating = "A"// if - else ifif rating == "A" { print("Very Good!!");} else if r... 阅读全文
posted @ 2015-12-16 12:41
Rinpe
阅读(171)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKit// for-infor i in -99...99{ i * i}let array = ["Rinpe", "Bobo", "Lili"]for (index, ... 阅读全文
posted @ 2015-12-16 12:39
Rinpe
阅读(175)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKit// 数据源let colors =[ "Air Force Blue":(red:93, green:138, blue:168), "Bittersweet... 阅读全文
posted @ 2015-12-16 12:38
Rinpe
阅读(244)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKitvar dict = [1:"one", 2:"two", 3:"three", 4:"four"]dict.countdict.isEmptydict[1]dict[66... 阅读全文
posted @ 2015-12-16 12:37
Rinpe
阅读(217)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKitvar str = "Hello, playground"var array = ["A", "B", "C", "D", "E", "F"]let arrayCount ... 阅读全文
posted @ 2015-12-16 12:36
Rinpe
阅读(163)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKit// 注意: swift中的字典用的也是中括号, 和OC的大括号是不同的// 初始化字典var dict1 = [1:"one", 2:"two", 3:"three"] ... 阅读全文
posted @ 2015-12-16 12:36
Rinpe
阅读(1270)
评论(0)
推荐(0)
摘要:
import UIKit // 声明数组 var array = ["A", "B", "C", "D", "E"]; var array2:[String] = ["A", "B", "C", "D", "E"]; var array3:Array<String> = ["A", "B", "C" 阅读全文
posted @ 2015-12-16 12:35
Rinpe
阅读(1139)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKitvar str = "Welcome to Play Swift! Step by Step learn Swift language from now!"// range... 阅读全文
posted @ 2015-12-16 12:33
Rinpe
阅读(801)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport Foundationvar str = "Hello, playground"str.capitalizedString // 字符串中所有单词首字母大写, 不改变str本身的值... 阅读全文
posted @ 2015-12-16 12:32
Rinpe
阅读(218)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKit// 拼接var str = "Hello, playground"str + "hello, swift" // 这样的拼接, str还是没有改变strstr +=... 阅读全文
posted @ 2015-12-16 12:30
Rinpe
阅读(178)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKitvar str = "hi"// 字符串拼接str += ", rinpe"str += ", lili"// 创建一个空的字符串var nullStr = String(... 阅读全文
posted @ 2015-12-16 12:18
Rinpe
阅读(163)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKitvar str = "Hello, playground"var a = 1, b = 10// a到b(包含a,b) [a,b]a...b// a到b-1(包含a,不包含... 阅读全文
posted @ 2015-12-16 11:43
Rinpe
阅读(219)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKitvar str = "Hello, playground"// nil的聚合运算可以说是为了可选值而出的 // 它的体现是"??"// eg:// a ?? b -> ... 阅读全文
posted @ 2015-12-16 11:37
Rinpe
阅读(239)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKitvar str = "Hello, playground"// 断言, 必须符合某个条件,程序才能继续运行下去// 可以看做是一个底线要求var age = 19;asse... 阅读全文
posted @ 2015-12-16 11:35
Rinpe
阅读(177)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can play import UIKit // swift中没有被赋值的变量是不能被使用的 //var str : String //str // Optionals 可选值 (用?号体现) // 或者是一个值 阅读全文
posted @ 2015-12-16 11:32
Rinpe
阅读(192)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKit// 元组就是将多个不同的值集合成一个数据/* 元组是Objective-C中没有的数据类型,与数组类似,都是表示一组数据的集合,但与数组不同,它的特点是: 特点: 1.可... 阅读全文
posted @ 2015-12-16 11:11
Rinpe
阅读(189)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKitvar str = "Hello, playground"let orangeAreYellowColor = truelet appleIsBlue = falseif ... 阅读全文
posted @ 2015-12-16 11:09
Rinpe
阅读(188)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKitvar str = "Hello, playground"// 数值类型转换let three = 3let PI = Double(three) + 0.1415926 ... 阅读全文
posted @ 2015-12-16 11:06
Rinpe
阅读(240)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKitvar str = "Hello, playground"let 十进制的10 = 10let 八进制的8 = 0o10let 二进制的2 = 0b10let 十六进制的1... 阅读全文
posted @ 2015-12-16 11:03
Rinpe
阅读(168)
评论(0)
推荐(0)
摘要:
import UIKitvar str = "Hello, playground"// 显式定义浮点型常量let PI:Float = 3.141592612312312let PI2:Double = 3.14123456789123123123// 隐式定义浮点型变量var randomFloa... 阅读全文
posted @ 2015-12-16 11:01
Rinpe
阅读(170)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKitvar str = "Hello, playground"let MAXVALUEOFUINT8 = UInt8.maxlet MINVALUEOFUINT8 = UInt... 阅读全文
posted @ 2015-12-16 10:57
Rinpe
阅读(186)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKitvar str = "Hello, playground"// 常量的定义用letlet maxLoginCount = 10// 变量的定义用varvar current... 阅读全文
posted @ 2015-12-16 10:54
Rinpe
阅读(175)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can playimport UIKitvar str = "Hello, playground"print("HelloWorld")print("hello, swift!")print("this is m... 阅读全文
posted @ 2015-12-16 10:51
Rinpe
阅读(144)
评论(0)
推荐(0)

浙公网安备 33010602011771号