Intro of Ruby

Estimated reading time: 1 minute

what is ruby

Ruby is a high level OOP programming Language .

Ruby is a dynamic, reflective, object-oriented, general-purpose programming language. It was designed and developed in the mid-1990s by Yukihiro Matz Matsumoto in Japan.

comments

# Single line comments
=begin
This is multi line comment with begin and end
=end
  • puts print with a new line
  • print print only with one line

String

puts 'single qoute string'
puts "Double qoute string"

symbol

  • : symbol keyword
  • fixed object id
name = :'mostafa'
name2 = 'mostafa'

puts name.object_id
puts name2.object_id

try catch

js rails
try..catch..finaly begin..rescue..ensure
begin
  eval "2/0"
rescue zeroDivisionError
  puts "error "
ensure
  puts 'thsi is final statement'

resource

official

ruby