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

Demosthenes Koptsis demosthenesk at gmail.com
Wed Aug 2 23:41:46 CEST 2023


Also

./Project140.gambas -a -b -c 'some extra'

not working


On 8/3/23 00:20, BB wrote:
>
>
> 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?
>
>
> ----[http://gambaswiki.org/wiki/doc/netiquette  ]----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230803/963eb83f/attachment.htm>


More information about the User mailing list