What will be the output of the given code? [code] boolean_1 = 2**3 != 3**2 || true puts boolean_1 [/code]

What will be the output of the given code?
Code:
 boolean_1 = 2**3 != 3**2 || true
puts boolean_1
A. True
B. False
C. Error
D. None of the mentioned
 
Answer: a
Explanation: 2**3=8 and 3**2=9 both the values are not equal is true and true or true will evaluate to true hence the overall expression will evaluate to true.
Code:
Output:
True
 

Tìm kiếm

Back
Top