[prev in list] [next in list] [prev in thread] [next in thread]
List: ruby-talk
Subject: Re: Can this code be more succinct
From: 7stud -- <bbxx789_05ss () yahoo ! com>
Date: 2009-04-30 6:33:53
Message-ID: fdd2acd3d7ae06c5afe112bd8fc79a98 () ruby-forum ! com
[Download RAW message or body]
7stud -- wrote:
>
> ...but then instead of having to look up the format of a case statement,
> you could just write:
>
> val = "red"
>
> if val == "blue"
> puts "blue"
> elsif val == "red"
> abort "code red"
> else
> puts "not recognized"
> end
>
> puts "program terminating normally"
...but then it is easier to type "when" than
"elseif<backspace><backspace><backspace>if". :)
--
Posted via http://www.ruby-forum.com/.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic