Array.clear method
Posted: Fri Dec 21, 2012 3:45 am
- Code: Select all
gothicBands = @['Tones on Tail', 'Bauhaus', 'Systers of Mercy']
Array.clear(gothicBands, 1, 2)
for gothicBand in gothicBands
print '[gothicBand], ' stop
When I run the above, I experience...
error: Argument 1 of method "clear" expects type Array?, but
the call is supplying type String[].
Compilation failed - 1 error
Not running due to errors above.
I change the code. Then all is well
- Code: Select all
gothicBands = @['Tones on Tail', 'Bauhaus', 'Systers of Mercy']
gothicBandsArr = Array.createInstance(Type.getType('System.String'), gothicBands.length)
for i in gothicBands.length
gothicBandsArr.setValue(gothicBands[i], i)
Array.clear(gothicBandsArr, 1, 2)
for i in gothicBandsArr.getLength(0)
print '[gothicBandsArr.getValue(i)], ' stop
Is there short a path without explicit work with Array class?