A煤n no tienes acceso a esta clase

Crea una cuenta y contin煤a viendo este curso

Arrays

15/33
Recursos

Aportes 24

Preguntas 0

Ordenar por:

驴Quieres ver m谩s aportes, preguntas y respuestas de la comunidad? Crea una cuenta o inicia sesi贸n.

var 馃懆鈥嶐煈┾嶐煈р嶐煈 : [String] = [鈥淏ombon鈥, 鈥淔a铆n鈥, 鈥淐ons鈥, 鈥淢acoy鈥漖
馃懆鈥嶐煈┾嶐煈р嶐煈.count

var pokemons : [String] = ["Bulbasaur", "Charmander", "Squirtle", "Pikachu", "Psyduck"]```
var family = [String]()
family.append("Gustavo")
family.append("Mac")
family.append("Eleuterio")
family.append("Gtz")
var familia : [(edad: Int, nombre: String)] = [(Int, String)]()
familia.append((23, "Andres"))
familia.append((26, "Antonio"))
familia.append((56, "Gerardo"))

for persona in familia{
    print("\(persona.nombre), tiene \(persona.edad)")
}

var paises = [鈥淓spa帽a鈥,鈥淏rasil鈥,鈥淢茅xico鈥漖
paises.append(鈥淐olombia鈥)
paises.insert(鈥淓U鈥,at:0)
paises.remove(at:1)

en c贸digo:

//Arrays
var someInts = [Int]()
someInts.count
someInts.append(5)
someInts.count
//vaciar:
someInts = []

// otra forma de inicializar:
var someDoubles = Array(repeating: 3.14159, count: 2)
var moreDoubles = Array(repeating: 2.5, count: 3)
// tambi茅n se pueden juntar:
var aLotOfDoubles = someDoubles + moreDoubles
aLotOfDoubles.count

// otra forma de inicializar:
var shoppingList : [String] = ["papas","cebollas","leche"]

les comparto mi reto.

var family : [String] = []

family.append("Andy")
family.append("Aleida")
family.append("jorge")
family.append("Daniel")

family.count

var shoppingCar : [String] = []

shoppingCar.append("the last of us 2")
shoppingCar.append("Cod movil")
shoppingCar.append("God of war")

print("la cantidad de juegos en el carrito son: \(shoppingCar.count)")
var family : [String] = ["Ricardo", "Milton", "Daniela", "Daniel", "Brenda"]
family.count

馃榿

var family : [String] = ["Maria","Victor","Daniela","Pepe"]
family.count

El ejercicio de la clase :p

var family = ["Profesor Utonio", "Bomb贸n", "Burbuja", "Bellota"]
family.count
//reto
var familyArray : [String] = ["Antonella", "Jorge", "Celia", "Rodrigo"]
//Ejercicio

var family : [String] = ["Javier", "Silvia", "Alex", "Ivonne", "Beto", "Dolly(mascota)"]

family.count
//Reto
var family: [String] = ["Carolina", "Martina", "Aisha", "Thomas"]

var familyHurtdo = [鈥淛esus鈥, 鈥淐arlos鈥, 鈥淐arlosHijo鈥, 鈥淔rank鈥, 鈥淗achi(mascota)鈥, 鈥淵ennifer鈥漖


var family = ["Jos茅 Miguel", "Ana Paula", "Nathalie Quetzalli", "Paulina"]
var family : [String] = ["Clever","Lourdes","Daniel","Belen","Yanella"]

for member in family {
    print(member)
}

Algo que not茅 y no s茅 si es por mi versi贸n de swift es que si inicializas un array vac铆o as铆 var family = [] y luego le intentas hacer un .append te dar谩 error porque como est谩 vac铆o no tiene desde donde inferir el tipo de dato que recibir铆a. A diferencia que si haces esto
var family = ["Mam谩"] o esto var family = [String] = [] y ah铆 si le haces el append.

// Form 1
var familyNames = [String]()
familyNames.append("Felipe")
familyNames.append("Isabel")
familyNames.append("Fernanda")
familyNames.append("Luis")
familyNames.append("Nataly")
familyNames.append("Ignacio")
familyNames.append("Vicente")

print(familyNames.count)

// Form 2
var familyNamesTwo = ["Felipe", "Isabel", "Fernanda", "Luis", "Nataly", "Ignacio", "Vicente"]

print(familyNamesTwo.count)

Reto:

var myFamily : [String] = ["Melania","Donald","Barron","Ivanka","Tiffany","Eric"]
myFamily.count

RETO:

var familyMembers = ["father", "mother", "brother1", "brother2"]
familyMembers.count