[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: Can you please help to make decision?
From:       William James <w_a_x_man () yahoo ! com>
Date:       2007-09-30 19:25:02
Message-ID: 1191180121.711605.303470 () n39g2000hsh ! googlegroups ! com
[Download RAW message or body]

On Sep 30, 1:25 pm, 7stud -- <dol...@excite.com> wrote:
> Here's a simple test for the op.  Which of the following do you think is
> easier to understand?  Can you guess what each program does?
>
> language1:
> --------
>
> colors = ["red", "blue", "green"]
>
> colors.each {|color| puts color}
>
> language2:
> ---------
> colors = ["red", "green", "blue"]
>
> for color in colors:
>     print color


E:\Ruby>irb --prompt xmp
colors = ["red", "blue", "green"]
    ==>["red", "blue", "green"]
puts colors
red
blue
green


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic