Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Code blocks with ternary operator or trailing conditionals

by kcott (Archbishop)
on Feb 09, 2014 at 04:13 UTC ( [id://1074094]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    if (condition) {
        statement 1;
    ...
        statement 3;
        statement 4;
    }
    
  2. or download this
    condition ? {statement 1; statement 2} : {statement 3; statement 4}
    
  3. or download this
    $ perl -e 'print "hello\n" and print "bye\n" if 1'
    hello
    bye
    
  4. or download this
    $ perl -e 'print("hello\n"), print "bye\n" if 1'
    hello
    bye
    
  5. or download this
    $ perl -e '1 ? (print "hello\n" and print "bye\n") : (print "hello2\n"
    + and print "bye2\n")'
    hello
    bye
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-19 10:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found