0
这使我疯狂了很久,我使用SIMPLE字符串替换,但它无法替换字符串(在这种情况下,它是'url' )根据它获得的信息。Ruby'sub!'如果/ elsif语句不会替换文本
class Test
myURL = 'www.google.com'
puts 'Where are you from?'
location = gets
if location == 'England'
myURL['.com'] = '.co.uk'
elsif location == 'France'
myURL['.com'] = '.co.fr'
end
puts myURL
end
我会疯了吗?
你不在代码中使用'sub!'。 – 2013-03-25 03:38:34