have more than two statements separated by && : Boolean Operators « Language Basics « Ruby






have more than two statements separated by &&


a = 1
b = 2
c = 3
d = 4
if a == 10 && b == 27 && c == 43 && d == -14
  print sum = a + b + c + d
end

 








Related examples in the same category

1.the && operator means "and."
2.use the keyword and instead of &&.
3.|| operator is or.
4.check whether one or the other is true by using ||
5.Are more than two statements OK?
6.Chaining together multiple comparisons is also possible with a clever use of parentheses:
7.And, or and Not
8.Use or in if statement