ruby hashing_prac.rb

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ruby hashing_prac.rb相关的知识,希望对你有一定的参考价值。


my_hash = {"jackie"=>"I  like bowling", "Luke"=>"likes riding his bike", "imogen"=>"I have a cold", "sara"=>"I ride bart"}

puts "Want to start a hash?"
response = gets.chomp

while response == "y"
  puts "Give us your name"
	key = gets.chomp

	puts "Tell us something about you"
	val = gets.chomp

	my_hash[key] = val

	puts "Continue?"
	response = gets.chomp
end

my_hash.each do |key, val| 
	print "#{key}\t#{val}\n"
end 

以上是关于ruby hashing_prac.rb的主要内容,如果未能解决你的问题,请参考以下文章

Ruby运算符

Ruby 25 岁了!Ruby 之父说 Ruby 3 有望 3 倍提速

如何学习ruby?Ruby学习技巧分享

ruby Ruby脚本,看看是否用openssl编译了ruby

什么是ruby?

ruby和ruby ee