Skip to content

Instantly share code, notes, and snippets.

@galileoguzman
Created August 12, 2015 13:44
Show Gist options
  • Save galileoguzman/495f4b2325afb9b53962 to your computer and use it in GitHub Desktop.
Save galileoguzman/495f4b2325afb9b53962 to your computer and use it in GitHub Desktop.
Condiciones básicas en SWIFT
//: Playground - noun: a place where people can play
import UIKit
// condiciones
var puntos = 0
if puntos > 0{
print("Ganaste")
}else{
print("Perdiste")
}
//Operador ternario
var resultado = puntos > 0 ? "Ganaste" : "Perdiste"
//If anidados
var nivel = 0
if puntos > 0{
print("Ganaste")
}else{
if nivel == 0{
print("Primer intento")
}else{
print("Se termino")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment