Created
March 23, 2020 23:55
-
-
Save faganello60/6114d84f874f56471f299baea9594a69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
// Inteiros: 1,2,3,4,5 | |
// Doubles: 1.1,1.2,1.334 | |
// String: "Hello" | |
// Const: let | |
// Variaveis: var | |
var a: Int = 1 | |
var b: Int = 5 | |
var c: Double = 3.2 | |
var d: String = "Olá mundo" | |
let a1 = 1 | |
let b1 = 2 | |
let c1 = 3.2 | |
let d1 = "Olá" | |
let x = a + b | |
let y = a - b | |
let z = a * b | |
let k = a / b | |
let u = a % b | |
if x > 0 { | |
print("X é positivo: \(x)") | |
} else if x < 0 { | |
print("X é negativo: \(x)") | |
} else if x == 4 { | |
print("X é igual a 0") | |
} | |
if (x > 10 && x < 20 && y == 30) || z == 5 { | |
print("X está entre 10 e 20") | |
} | |
switch x { | |
case 10: | |
print("X == 10") | |
case 11: | |
print("X == 11") | |
case 12: | |
print("X == 12") | |
default: | |
print("Default X == \(x)") | |
} | |
let b2 = x < 0 ? 5 : -5 | |
// Equivalente ao codigo abaixo | |
//var b3 = 0 | |
//if x > 0 { | |
// b3 = -5 | |
//} else { | |
// b3 = 5 | |
//} | |
//print(b3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment