[Gambas-user] gb.Args component, FOR EACH...NEXT not working

Bruce Steers bsteers4 at gmail.com
Wed Aug 2 23:22:27 CEST 2023


On Wed, 2 Aug 2023, 22:11 Demosthenes Koptsis, <demosthenesk at gmail.com>
wrote:

> i test gb.Args component with the following code
>
> ----------------------------------
>
> ' Gambas module file
>
> Public Sub Main()
>
>    Dim sElement As String
>
>    For Each sElement In Args
>      Print sElement
>    Next
> End
> ------------------------------------
>
> When i run the Project140.gambas with parameters i get output only for
> command name
>
> ----------- Console -----------
>
> ./Project140.gambas -1 -2 -3
> ./Project140.gambas
> ----------------------------------
>
> the parameters -1 -2 -3 are omitted
>

The Args.class itself is not enumerable you must use the All property...

For Each sElement In Args.All
     Print sElement
Next

BruceS

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230802/4a5400d4/attachment.htm>


More information about the User mailing list