Swift: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 25: | Line 25: | ||
==Switch Statements== | ==Switch Statements== | ||
No surprises | No surprises | ||
<syntaxhighlight lang="swift"> | |||
switch a { | switch a { | ||
case "a": | case "a": | ||
Line 33: | Line 34: | ||
print("we are here not a or b") | print("we are here not a or b") | ||
} | } | ||
</syntaxhighlight> |
Revision as of 00:07, 24 June 2022
Introduction
Here is my first dip into Apple and swift Swift Cheat Sheet
Data Types
Here we have the following Primatives
- Int
- Float
- Double
- Str
- Bool
Control
If Statements
No surprises
if a < 4 {
print("we are here 1")
}
else if a == 4 && a < 3 {
print("we are here 2")
}
else {
print("we are here 3")
}
Switch Statements
No surprises
switch a {
case "a":
print("we are here a")
case "b":
print("we are here b")
default:
print("we are here not a or b")
}