Skip to content

Instantly share code, notes, and snippets.

@JamesVStone
Created April 16, 2018 21:31
Show Gist options
  • Save JamesVStone/8a2713e6e620a5e715c0c713e03505af to your computer and use it in GitHub Desktop.
Save JamesVStone/8a2713e6e620a5e715c0c713e03505af to your computer and use it in GitHub Desktop.

Mastering Arrays

Arrays are like lists, or the ability to store multiple values in a single variable. For example, if you wanted to add scores or even just condence your code.

Visual Basic

In visual basic to create an array you must declare traditionaly with "Dim" but after the name you must specify how many items you want in your array (0 included).

Dim myName(1) As String

MyName(0) = "James" MyName(1) = "Stone"

Dim fullName As String = MyName(0) + ' ' + MyName(1)

Python

Arrays in python are more simple in the fact that you do not have to declare the amount of items in the the list. Arrays are marked by sqaure brackets [] with comma deliminated items. To call items by index (starting at 0) you put the

listName[0]

for the first item

 listName[1]```
  and so on
```python

myName = ["James", "Stone"]
fullName = myName[0] + ' ' + myName[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment