Creates a new empty array, my_array = Array.new, Returns the number of items the array contains, my_array.length, access the item at a given position within an array, my_array[1], Deletes the item at a given index and returns it, my_array.delete_at(1), iterate over all elements in an array, my_array.each do |item| puts item end, Returns the very first item of the array, my_array.first, Returns the very last item of the array, array.last, Returns a boolean, whether the array contains a certain element or not, array.include?(item), Removes the last item of the array and returns it, my_array.pop, Adds an item to the end of the array, my_array.push(4) my_arry<<4, Returns a copy of the array with the elements in reverse order, my_array.reverse, Returns a sorted copy of the array, [5, 2, 4].sort, Returns a copy of the array with duplicates removed, [1, 1, 2, 2].uniq
0%
Arrays
Compartir
Compartir
per en/la
Vwandeler
Editar continguts
Imprimir
Incrustar
Més
Assignacions
Tauler de classificació
Mostrar-ne més
Mostrar-ne menys
Aquesta taula de classificació és privada actualment. Fés clic a
Compartir
per fer-la públic.
El propietari del recurs ha inhabilitat aquesta taula de classificació.
Aquesta taula de classificació està inhabilitada perquè que les teves opcions són diferents a les del propietari del recurs.
Reverteix les opcions
Emparellar
és una plantilla de final obert. No genera puntuacions per a una taula de classificació.
Cal iniciar la sessió
Estil visual
Tipus de lletra
Subscripció obligatòria
Opcions
Canvia de fonament
Mostrar-ho tot
Resultats oberts
Copiar enllaç
Codi QR
Suprimir
Restaurar desada automàtica:
?