Created
August 12, 2015 13:44
-
-
Save galileoguzman/495f4b2325afb9b53962 to your computer and use it in GitHub Desktop.
Condiciones básicas en SWIFT
This file contains hidden or 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
//: 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