What was the meaning of this #{ }?


#1



What was the meaning of this #{  }


#2

In Ruby # is used to 'comment' out code, or basically to make sure the compiler disregards whatever proceeds it. Typically it's used to make your code more legible to someone that is just reading through, trying to figure out what your code actually does. An example being:

#An if loop that checks if x is equal to y 
#The compiler doesn't read this line since a # proceeded the code
if x == y
  return x
end

Since you gave us no other context as to what problem you're on, or what the { } are for, or used after/before, that's the only way I can currently help you. If that didn't answer your question, please be a bit more specific and I (or someone else) will gladly try to assist you!


#3

@agustin7,
From
https://en.wikibooks.org/wiki/Ruby_Programming/Strings
Double quotes[edit]

Double quotes allow for many more escape sequences than single quotes. They also allow you to embed variables or Ruby code inside of a string literal – this is commonly referred to as interpolation.

puts "Enter name"
name = gets.chomp
puts "Your name is #{name}"