Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] one line if else

Expand Messages
  • Hudson T Clark
    WOW, thanks thats not even using a if word! =)
    Message 1 of 3 , May 1, 2003
    • 0 Attachment
      WOW, thanks thats not even using a "if" word! =)
    • Kipp, James
      ... 1 ? print hello : print goodbye
      Message 2 of 3 , May 1, 2003
      • 0 Attachment
        > Ok I know I can do:
        >
        > print "Hello" if 1;
        >
        > But how could I do an if else in one line? I have been playing around
        > with the syntax and haven't been able to figure it out =/.
        >

        1 ? print "hello" : print "goodbye"
      • Hans Ginzel
        ... print $value ? hello : goodbye ; perldoc perlop `?: Hans -- www.perldoc.com
        Message 3 of 3 , May 3, 2003
        • 0 Attachment
          On Thu, May 01, 2003 at 08:46:02AM -0400, Kipp, James wrote:
          > > But how could I do an if else in one line? I have been playing around
          > > with the syntax and haven't been able to figure it out =/.
          >
          > 1 ? print "hello" : print "goodbye"

          print $value ? "hello" : "goodbye";

          perldoc perlop `?:'

          Hans

          --
          www.perldoc.com
        Your message has been successfully submitted and would be delivered to recipients shortly.