Ruby Hashes Ruby Hash is a collection of key-value pairs. The Ruby Hash is created using key-value pair within {}. Hashes syntax myMethod = Hash.new( "myHashName" ) Hashes example myMethod = Hash.new( "myHashName" ) myHashName = {"10" => "A", "20" =>...
Ruby Array The Ruby array is created using the objects between [ and ]. Ruby arrays are ordered collections of elements. Array syntax myArrayName = Array.new Array new class method example myArrayName = Array.new(30) puts myArrayName.size puts myArrayName.length Output 30 30...
Ruby Date and Time The Ruby Date, DateTime and Time examples. Date and Time syntax Date DateTime Time Date and Time example cTime = Time.now puts "Current Time : " + cTime.inspect puts cTime.year puts cTime.month puts cTime.day require 'date' puts...
Ruby Variables The Ruby Variables syntax and examples. Local Variables syntax Local Variables variable_name = variable_value Global Variables $variable_name = variable_value Class Variables Instance Variables Local Variables example irb(main):001:0> x=1 => 1 irb(main):002:0> x => 1 irb(main):003:0> Variables example x=1 puts...