码迷,mamicode.com
首页 >  
搜索关键字:func    ( 15298个结果
swift 有些语法还是不支持。
“func makeIncrementer() -> (Int -> Int) { func addOne(number: Int) -> Int { return 1 + number } return addOne } var increment = makeIncrementer() increment(7)” 摘录来自: Apple Inc. “T...
分类:其他好文   时间:2014-06-20 13:27:56    阅读次数:161
Nodejs Express框架
好了,今天我们开始分享Node. learn to share . yes , it is ,especially share your happiness with others. 好了,进入正题. var express  = require('express'); var app = express.createServer(); app.get('/',func...
分类:Web程序   时间:2014-06-07 15:24:26    阅读次数:230
Swift中文教程(四)--函数与闭包
Function 函数 Swift使用func关键字来声明变量,函数通过函数名加小括号内的参数列表来调用。使用->来区分参数名和返回值的类型:1 func greet(name: String, day: String) -> String {2 return "Hello \(name)...
分类:其他好文   时间:2014-06-06 16:41:44    阅读次数:278
Swift中文教程(四)--函数与闭包
原文:Swift中文教程(四)--函数与闭包Function 函数 Swift使用func关键字来声明变量,函数通过函数名加小括号内的参数列表来调用。使用->来区分参数名和返回值的类型:1 func greet(name: String, day: String) -> String {2 retu...
分类:其他好文   时间:2014-06-06 11:27:32    阅读次数:213
Swift 类和对象
创建和使用类 Swift 使用class创建一个类,类可以包含字段和方法:1 class Shape {2 var numberOfSides = 03 func simpleDescription () -> String {4 return "A shape w...
分类:其他好文   时间:2014-06-06 09:12:07    阅读次数:217
next enum in swift
```cppenum Iter: Int{ case s1=0, s2, s3, s4 mutating func next(){ if self == .s4 { self = .s1 return } ...
分类:其他好文   时间:2014-06-06 09:07:38    阅读次数:215
Swift 泛型(generics)
Swift 使用来声明泛型函数或泛型类型:1 func repeat(item: ItemType, times: Int) -> ItemType[] {2 var result = ItemType[]()3 for i in 0..times {4 result...
分类:其他好文   时间:2014-06-06 07:52:02    阅读次数:299
Swift函数和闭包
函数 Swift 使用func关键字声明函数:1 func greet (name: String, day: String) -> String {2 return "Hello \(name), today is \(day)."3 }4 greet ("Bob", "Tuesday"...
分类:其他好文   时间:2014-06-06 07:49:12    阅读次数:340
Swift 协议(protocol)和扩展(extension)
协议 Swift 使用protocol定义协议:1 protocol ExampleProtocol {2 var simpleDescription: String { get }3 mutating func adjust ()4 }类型、枚举和结构都可以实现(adopt)协议...
分类:其他好文   时间:2014-06-06 07:48:38    阅读次数:302
swift的泛型貌似还差点意思
protocol Container { typealias ItemType mutating func append(item: ItemType) mutating func removelast() -> ItemType var count: Int {get} ...
分类:其他好文   时间:2014-06-05 20:10:14    阅读次数:319
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!