Looking at Swift after so many months of “no programming” is very cool because is a very easy language to learn and without so many restrictions.
The usual formats from C and C# are almost the same, but you need to be careful at indentation.
x=1+1 in not the same with
x = 1 + 1 the first will give you an error and the second one will work.
Some other things that I noticed:
- there is no
;at the end of line
- variables can be declared with explicit type but is not necessary
- “This is a variable in a String(variable)”
repeat..whilework as usual just that
ifwill evaluate just a bool expression.
for i in 0..<10is the same with
for var i = 0; i < 4; ++i
..<to make a range that omits its upper value, and use
...to make a range that includes both values.”
functo declare a function
func greet(name: String, day: String) -> String
A very comprehensive list of Swift functions functionality can be found on objc.io