Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: loopy trouble

by Anonymous Monk
on Jan 07, 2016 at 21:28 UTC ( [id://1152250]=note: print w/replies, xml ) Need Help??


in reply to Re: loopy trouble
in thread loopy trouble

For perl 6?

Replies are listed 'Best First'.
Re^3: loopy trouble
by stevieb (Canon) on Jan 07, 2016 at 21:50 UTC

    Exactly the same (note that with perl6, you can omit the parens):

    #!/usr/bin/perl6 for (1..3){ print "$_\n"; }

    ...or, you can use say. (You can in perl5 as well, if you use feature 'say';):

    for (1..3){ say $_; }

    or a shortcut if you're only doing a small task (same as perl5):

    print "$_\n" for 1..3; say $_ for 1..3;
Re^3: loopy trouble
by Your Mother (Archbishop) on Jan 07, 2016 at 21:30 UTC

      many thanks, very useful link you shared. Is there a place where i can get exercises from easy to very hard. I find that i learn better by solving problems.

        Rosetta Code would be a good starting point (depending on your personal definition of "easy" and "hard", of course).

        Agreed. I find that the best place most of the time to find learning/sample code is the test suites of Perl packages. Perl has an above average testing culture I think. This turned up a few interesting things and I’m sure there is plenty more in there–

        moo@cow[63]~/.rakudobrew>ack \\bloop\\b -l moar-v6.c/ | ack \\.t$ moar-v6.c/nqp/examples/rubyish/t/loops.t moar-v6.c/nqp/examples/rubyish/t/template.t moar-v6.c/nqp/t/jvm/01-continuations.t moar-v6.c/nqp/t/moar/01-continuations.t moar-v6.c/nqp/t/moar/02-qast-references.t moar-v6.c/nqp/t/nqp/14-while.t moar-v6.c/nqp/t/nqp/15-list.t moar-v6.c/nqp/t/nqp/42-cond-loop.t moar-v6.c/nqp/t/nqp/84-loop-labels.t moar-v6.c/nqp/t/parrot-pmc/qrpa.t moar-v6.c/nqp/t/qast/01-qast.t

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1152250]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2024-04-23 14:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found