[swift] Hello Swift
The
conclusion before writing Swift language
1. let
using let keyword
let
lang= "Swift"
println("Oh my \(lang)")
println("Oh my \(lang)")
2. Using
comment can be used // or /*… */
the comment on Swift
is still c-style :
// for single line
/*
// 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
to be continued…
No comments:
Post a Comment