[Gambas-user] gb.Args component, FOR EACH...NEXT not working
BB
adamnt42 at gmail.com
Wed Aug 2 23:20:35 CEST 2023
On 3/8/23 6:40 am, Demosthenes Koptsis 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
>
>
-1, -2 and -3 are *Options* not *Arguments*. Consider this, on the
command line, those options are strings, they start with a "-" which
indicates that. They are not values. Arguments are values.
Try ./Project140.gambas -a -b -c
You should get the same i.e. only the command name.
Try ./Project140.gambas -a -b -c 'some extra'
See the difference?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230803/dd9773ea/attachment.htm>
More information about the User
mailing list