Ruby Program to Demonstrate the Logical Operators

You are currently viewing Ruby Program to Demonstrate the Logical Operators

Ruby program to demonstrate the logical operators

# Ruby program to demonstrate 
# the logical operators

num1 = 5
num2 = 2

puts("Logical AND: ",num1==5 && num2==2)
puts("Logical OR : ",num1==5 || num2==2)
puts("Logical AND: ",num1==4 && num2==2)
puts("Logical OR : ",num1==2 || num2==5)

Output

Logical AND: 
true
Logical OR : 
true
Logical AND: 
false
Logical OR : 
false

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply