+ 5

Ruby - A strange boolean operator

Given this code: int = 0 str = "" if int && str then puts 1 else puts 0 end why does it output 1, that is, why the "and" is true?

31st May 2019, 10:30 AM
Paolo De Nictolis
Paolo De Nictolis - avatar
2 odpowiedzi
- 1
Hi to everyone
2nd Jun 2019, 7:03 AM
Promise