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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top