Thursday, June 04, 2015

[swift] Hello Swift

[swift] Hello Swift
The conclusion before writing Swift language
1. let using let keyword
let lang= "Swift"
println("Oh my \(lang)")
2. Using comment can be used // or /*… */
the comment on Swift is still c-style :
// for single line
/*
*/ for multiline

3. Assigning variable both of var and let
let use for the variable cannot be changed value if you want to change value on runtime you could use var keyword

4. The end of statement
When the end of statement unnecessary use ; if the statement is too short, you use ; for create next statement

 5.  Don’t worry about break keyword
for c-style, writing the code for condition switch, often you miss break keyword it makes the code run out of command but the Swift language prevent it
6. Writing method with func keyword
When you create method or function, the easy keyword you can write func
Top of Form


to be continued…

No comments: