Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: why not listed foreach and if?

by dsheroh (Monsignor)
on Feb 02, 2025 at 11:56 UTC ( [id://11163912]=note: print w/replies, xml ) Need Help??


in reply to Re^2: why not listed foreach and if?
in thread why not listed foreach and if?

Assuming that the comment you replied to was serious (rather than satire of the initial post or trolling), I believe that they were referring to JS allowing you to omit the {braces} when it's only a single statement. Perl allows if (condition) {statement;} (with braces) and statement if condition; (no braces with postfix conditional), but not if (condition) statement; (no braces with prefix conditional).

Replies are listed 'Best First'.
Re^4: why not listed foreach and if?
by GrandFather (Saint) on Feb 02, 2025 at 20:16 UTC

    Actually JavaScript and most C like languages don't see the difference between if (<condition>) <statement> and if (<condition>) <block> because a <block> can go anywhere a <statement> can go. Interestingly, and the point of difference here is, Perl requires a <block> in many places where more Cish languages are happy with just a <statement>.

    Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2026-02-18 17:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.