Arrays: Difference between revisions

no edit summary
No edit summary
Line 2,438:
myfruits[1] = "banana"
</lang>
 
={{header|Gambas}}==
 
In Gambas, you DO need to dimension arrays. The first element of an array is numbered zero. The DIM statement is optional and can be omitted ONLY if defined as a Global variable.
 
'''[https://gambas-playground.proko.eu/ You can run this code. Copy the code, click this link, paste it in and press 'Run !']'''
<lang gambas>Public Sub Main()
Dim sFixedArray As String[] = ["Rosetta", "code", "is", "a", "programming", "chrestomathy", "site"]
Dim sFixedArray1 As New String[10]
Dim iDynamicArray As New Integer[]
Dim siCount As Short
 
For siCount = 1 To 10
iDynamicArray.Add(siCount)
Next
 
sFixedArray1[5] = "Hello"
sFixedArray1[6] = " world!"
 
Print sFixedArray.Join(" ")
Print iDynamicArray[5]
 
Print sFixedArray1[5] & sFixedArray1[6]
 
End</lang>
Output:
<pre>
Rosetta code is a programming chrestomathy site
6
Hello world!
</pre>
 
=={{header|GAP}}==
Anonymous user