Problem with ruby code.

D

Deza Awesome

A simple code that is self explanaetary. However when I run it, it spits
out errors at me :( What do I do to make it work?


def heLLO
puts 'whats your name'
name = gets.chomp
puts "hello ". + name
end


V2 = Array.new [1 + rand(22)]



V1 = Array.new [1 + rand(22)]

def questioN
puts 'whats the sum of' V2.to_s + 'and' + V1.to_s
end


heLLO
questioN
 
S

Stefano Crocco

A simple code that is self explanaetary. However when I run it, it spits
out errors at me :( What do I do to make it work?


def heLLO
puts 'whats your name'
name = gets.chomp
puts "hello ". + name
end


V2 = Array.new [1 + rand(22)]



V1 = Array.new [1 + rand(22)]

def questioN
puts 'whats the sum of' V2.to_s + 'and' + V1.to_s
end


heLLO
questioN

You need a + before V2 in the body of questioN

Stefano
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,186
Latest member
vinaykumar_nevatia

Latest Threads

Top