[Gambas-user] Idea for arrays: .SWAP function
Bruce Steers
bsteers4 at gmail.com
Fri Oct 9 10:02:04 CEST 2020
There is a command Swap
http://gambaswiki.org/wiki/lang/swap
will this work?
*Swap(klName[po], klName[po+1])*
BruceS
On Fri, 9 Oct 2020 at 08:56, Rolf-Werner Eilert <rwe-sse at osnanet.de> wrote:
> Hi Benoit and all,
>
> Just had this one in a current project. To enable the user to push an
> entry in a list one up or down, I have to swap the related values in
> several arrays. There seems to be no swap function, so I have to write 3
> lines of codes for it, like this:
>
> t$ = klName[po]
> klName[po] = klName[po + 1]
> klName[po + 1] = t$
>
> I have to use these 3 lines for each array. How much easier it would be
> if I could use a function like for this:
>
> klName.Swap(po, po+1)
>
> This would also make sense in ListBox etc.
>
> I think this would enhance code and readability a lot.
>
> Regards
> Rolf
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20201009/65bdf411/attachment.htm>
More information about the User
mailing list