On 2020-05-18 17:14, Peter Pentchev wrote:
On Mon, May 18, 2020 at 04:53:31PM -0700, ToddAndMargo via perl6-users wrote:
In 2020-05-18 16:11, Peter Pentchev wrote:
As an exercise for the reader: once the above sinks in, what exactly
will "say if 'h:/'.IO.d" do?

It returns the the result of the expression that
"if" evaluated.

OK, so why does it give you an error message if you run it? :)

Not quite.

     say if 'h:/'.IO.d

...is equivalent to:

     if 'h:/'.IO.d {
         say;
     }

....which would have been valid in Perl (apart from the parentheses
around the condition of the "if", Raku allows you to omit those), but
it is not valid Raku. Run it and see what it says.

Once again you thought that "if" returns a value. "If" does not return
a value, it is not a function, it is a statement. Just the same as "for"
does not return a value, and "while" does not return a value.

G'luck,
Peter


Hi Peter,

Of course!  I am not arguing with anyone that
they are not right!

I am doing what I am doing to make things easier for
me to read in the future.  Since I am already using
a very high level language, what is one more affront
to my CPU?

:-)

-T

Reply via email to