I was wondering whether it is possible to create a global variable from within a method.
So in the example below I would like to re-use the s_name variable from outside the method. How can I do this?
# start method
def start
# Start the story
puts "Hello and welcome to the superhero space station, my name is Zakhtar and I am a beautiful mermaid."
puts "Please state your superhero name"
# Gets superhero name
print "> "
# The dollar sign should give the vaiable global scope. Check!
s_name = gets.chomp
# Says hello to the superhero
puts "Pleased to meet you #{s_name}, we are in urgent need of your help!"
# Line break
puts "\n"
puts "Follow me and I will show you the problem..."
death
# end start method
end