[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Multiple Assignments: Newbie question

Anthony Eden

9/5/2007 11:46:00 AM

On 9/5/07, Z T <zoater@gmail.com> wrote:
> When I run my program:
>
> arg1="Ruby", arg2="Rails", arg3="Rails"
> puts "#{arg1}, #{arg2}, #{arg3}"
>
> Why is the output as follow:
> RubyRailsRails, Rails, Rails
>
> What is the reason for this output? Thanks in advance.
>

The comma is for separating array items. If you were to write:

arg1 = "Ruby","Rails","Rails"

You'd see that arg1 is an array with those values.

What you want is:

arg1 ="Ruby"; arg2 = "Rails"; arg3 = "Rails"

Or something along those lines.

V/r
Anthony

--
Cell: 808 782-5046
Cell: 321 505-0025
Current Location: Melbourne, FL