Examveda

What is the output of the given code?
x=1
    if x > 2
    puts "x is greater than 2"
    elsif x <= 2 and x!=0
    puts "x is 1"
    else
    puts "I can't guess the number"
    end

A. x is greater than 2

B. x is 1

C. I can't guess the number

D. None of the mentioned

Answer: Option B


This Question Belongs to Ruby Programming >> Control Structures In Ruby

Join The Discussion

Related Questions on Control Structures in Ruby