On Tue, May 19, 2020 at 03:16:41PM +0300, Peter Pentchev wrote:
> On Mon, May 18, 2020 at 10:58:26PM -0700, ToddAndMargo via perl6-users wrote:
> > 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?
> 
> Todd, I'm trying to tell you that you seem to misunderstand
> what "if" does. Please read my answer again: your idea of
> what "say if 'h:/'.IO.d" does is incorrect, "if" does not do
> what you think it does, and this is *essential* for understanding
> and writing Raku programs (or programs in pretty much any other
> language). Understanding the difference between functions and
> control statements is *essential*.

...control structures, I mean.

G'luck,
Peter

-- 
Peter Pentchev  r...@ringlet.net r...@debian.org p...@storpool.com
PGP key:        http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13

Attachment: signature.asc
Description: PGP signature

Reply via email to