Ruby and Ruby on Rails interview questions

Hello friends in this post I will daily add one new interview question related to Ruby or Ruby on Rails so please bookmarked this post because here you will find all the possible interview questions related to Ruby and Ruby on Rails.

Que 1- What is the difference in == and === in Ruby?
Ans: == is used to compare the equality of two object.
Example a = 5, b = 6
puts a == b //output false
puts a == 5 //output true

In other hand === is used to check if given number or character is included in particular range.
Example nums = 1..50
puts nums === 25 //output true
puts nums === 66 //output false

No comments:

Post a Comment