When I write below code in Ruby it gives me an error :
x = "c:/"
y = "Users/Amiref"
z = "/"
h = "Downloads"
v= x+y+z+h
Dir.foreach("v") do |i|
puts i
end
but when I use below code Ruby doesn’t give me any error :
Dir.foreach("c:/Users/Amiref/Downloads") do |i|
puts i
end
I am really confused . please help me .
thanks
v shouldn’t be quoted – it’s being used as a variable and not a string.