Hash

Write programs which uses associative arrays concept of Ruby.
hash.rb
student = Hash["rollno"=>501,"name"=>"RISE Gandhi","Address"=>"Valluru"]
student.each do |key,value|
print(key,"\t:\t",value,"\n")
end
OUTPUT
rollno : 501
name : RISE Gandhi
Address : Valluru

No comments:

Post a Comment

Total Pageviews