Technology Software

How to Add Elements to the End of an Array

    • 1). Decide on the programming language you'll be using. Conceptually, you'll be doing the same thing regardless of the language.

    • 2). Open your favorite text editor. Again, it doesn't matter what text editor you'll be using; it will be conceptually the same.

    • 3). Type the following into your text editor. If your language isn't included here, consult your documentation for the "push" function/method.

      Ruby:

      "myArray.push('something')"

      Python:

      "my_array.append('something')"

      PHP:

      "array_push($my_array, 'something')"

    • 4). Save the file with the appropriate extension and run it.

Leave a reply