[Gambas-user] Array slicing - how is it done in Gambas?

RICHARD WALKER richard.j.walker at ...247...
Wed Oct 10 22:23:29 CEST 2012


Let's say I have a string array with 12 elements. I want to pass some
of these to a function for processing. What notation do I use to
specify, say, the "sub-array" comprising elements 6, 7 and 8 of the 12
element array?

At the moment I can only do it by creating a new array of appropriate
size and copying the required elements into it. An equally ugly
alterrnative would be to pass the whole array with a couple of index
variables to define the limits. Or I could copy the whole array and
delete the unwanted elements.

I was really hoping that my_array[6 To 12] would work, but not in
Gambas it seems.

Richard




More information about the User mailing list