Get it on one line?

Hello pros!

Im pretty new at Ruby and doing some toturials!
But what i don’t understand is how i get the Puts on the same line in
the following code; I know i need to use .chop!? but were in the code?

Ty!

class Hund

def namn (aName)
@myname = aName

end

def skrivnamn
  [email protected]

end

def color (acolor)
  @mycolor = acolor

end
def skrivcolor

  [email protected]

end

def talk
  return("den låter följande Woof".center(10))

end

mydog=Hund.new
mydog.namn(“Patric Åberg”.center(12))
mydog.color(“Min hund är röd”.center(10))
puts (mydog.skrivnamn)
puts (mydog.skrivcolor)
puts(mydog.talk)

yourdog=Hund.new
yourdog.namn(“Karl Svart”.center(10))
yourdog.color(“Min hund är svart”.center(10))
puts (yourdog.skrivnamn)
puts (yourdog.skrivcolor)
puts (yourdog.talk)

end

Either puts “#{a}#{b}#{c}” or print a; print b; puts c

Ryan D. wrote in post #1099190:

Either puts “#{a}#{b}#{c}” or print a; print b; puts c

How do you mean, started Ruby today… (:

Complete some of the many online tutorials before asking on forums.
“#{ variable }” <- This is called “interpolation”. Look it up.

On Tue, Feb 26, 2013 at 8:13 PM, Ryan D. [email protected]
wrote:

Either puts “#{a}#{b}#{c}” or print a; print b; puts c

In this case it’d rather be

puts a, b, c

Cheers

robert

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs