Re: A question on AND

2023-07-01 Thread ToddAndMargo via perl6-users
> On 30/06/2023 06:06, ToddAndMargo via perl6-users wrote: >> if @*ARGS.elems > 0 && "@*ARGS[0]".lc eq "debug" {...} On 6/30/23 02:40, Richard Hainsworth wrote: I tried this and it worked without any problem. And today is is working for me as well without a problem. I must have had somethin

Re: A question on AND

2023-06-30 Thread Andy Bach
;> that you can safely use them after a list operator without the need >> for >> parentheses: >> >> unlink "alpha", "beta", "gamma" >> or gripe(), next LINE; >> >> With the C-style

Re: A question on AND

2023-06-30 Thread yary
out the need for > parentheses: > > unlink "alpha", "beta", "gamma" > or gripe(), next LINE; > > With the C-style operators that would have been written like this: > > unlink("alpha", "beta", "ga

Re: A question on AND

2023-06-30 Thread Andy Bach
s(unlink("alpha", "beta", "gamma")) { gripe(); next LINE; } Using "or" for assignment is unlikely to do what you want; see below. From: yary Sent: Friday, June 30, 2023 8:45 AM To: Richard

Re: A question on AND

2023-06-30 Thread Vadim Belman
And then nobody mentions that `and` has low priority. Try `say 42 & 13` and `say 42 and 13`. Best regards, Vadim Belman > On Jun 30, 2023, at 9:45 AM, yary wrote: > > Most of Richard's parting suggestions I understand & agree with, but not > this: " why are you using '&&' and not 'and' " >

Re: A question on AND

2023-06-30 Thread yary
Most of Richard's parting suggestions I understand & agree with, but not this: " why are you using '&&' and not 'and' " My habit (from Perl 5 days) is to use && || for expressions, and reserve "and" "or" for "do this if assignment/function call without parens succeeds/fails" – is there a refinemen

Re: A question on AND

2023-06-30 Thread Richard Hainsworth
I tried this and it worked without any problem. Here's the whole program: use v6.d; say @*ARGS.raku; if @*ARGS.elems > 0 && "@*ARGS[0]".lc eq "debug" { say 'got' } and at the terminal: $ raku todd-test.raku debug --debug=50 ["debug", "--debug=50"] got FWIW why are you quoting ARGS? The .l

A question on AND

2023-06-29 Thread ToddAndMargo via perl6-users
Hi All, This gets the finger wagged at me for a "Nil" when @*ARGS.elems equals zero: if @*ARGS.elems > 0 && "@*ARGS[0]".lc eq "debug" {...} I have to do this instead: if @*ARGS.elems > 0 { if "@*ARGS[0]".lc eq "debug" {...} } Do I misunderstand something? In an AND, is not the test