No tienes acceso a esta clase

隆Contin煤a aprendiendo! 脷nete y comienza a potenciar tu carrera

Aprende todo un fin de semana sin pagar una suscripci贸n 馃敟

Aprende todo un fin de semana sin pagar una suscripci贸n 馃敟

Reg铆strate

Comienza en:

0D
16H
55M
14S

Arrays

15/33
Recursos

Aportes 31

Preguntas 0

Ordenar por:

驴Quieres ver m谩s aportes, preguntas y respuestas de la comunidad?

o inicia sesi贸n.

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

var pokemons : [String] = ["Bulbasaur", "Charmander", "Squirtle", "Pikachu", "Psyduck"]```

Chale, he sido humillado鈥 :'P

var jonathanFamily : [String] = ["Jonathan"]

print("\(jonathanFamily) 馃懇馃徎鈥嶐煢")

Bueno mejor pondr茅 a los personajes de la familia de la pel铆cula Predestination, aprovechando que tambi茅n era uno nada m谩s jaja

var predestinationFamily = ["Baby馃懚馃徑","Jane馃懇馃徑","Jhon馃馃徑","Agent Doe馃馃徑","Fizzle Bomber馃馃徑鈥嶁檧锔"]

for member in predestinationFamily {
    member.contains("Fizzle")
    ? print(member)
    : print(member + " = " , terminator: "")
}
var family = [String]()
family.append("Noelia")
family.append("Isaac")
family.append("NALA")
family.append("JANA")
family.append("ONYX")
family.append("CORA")
family.count

let family2 = ["Noelia", "Isaac", "NALA", "JANA", "ONYX", "CORA"]
family2.count

Mi ejemplo de cuando me case 馃槢

var verosFamily = ["Sam", "Candelaria", "Vero", "Pato", "Laurita"]
var ulisessFamily = ["Gisela", "Ulises"]
var newBigFamily = verosFamily + ulisessFamily
var family2: [String] = ["Papa", "Mama", "Hijo1", "Hijo2", "Hijo3"]

var familyCounter = 0

for familytree in family2{
    
    if familytree.hasPrefix("Hijo"){
        familyCounter += 1
    }
}

if familyCounter > 1{
    
    print("tengo \(familyCounter) hijos")
}else{
    print("tengo \(familyCounter) hijo")
}

var hijos = familyCounter > 1 ? "Tengo \(familyCounter) hijos" : "No tengo \(familyCounter) hijo"

var 馃懆鈥嶐煈┾嶐煈р嶐煈 = [鈥淧apa 馃懆馃徎鈥嶁殩锔忊, 鈥渕ama 馃懇馃徏鈥嶐煆,鈥渉ermano 馃懆馃徎鈥嶐煉烩,鈥渉ermana 馃懜馃徎鈥,鈥渕iPerrito 馃悤鈥漖

var family : [String] = ["Roberto", "Miriam", "Facundo", "Simon", "Pamela", "Lisandro"]
 
for toPrintFamily in family {
    print(toPrintFamily)
}
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