Reputation: 180
Str1, Str2 = "aardvark", "zebra"
print(Str1 < Str2 and Str1 .. Str2 or Str2 .. Str1)
The Output is : aardvarkzebra
When i remove Str1, the output was still the same
Str1, Str2 = "aardvark", "zebra"
print(Str1 < Str2 and Str1 .. Str2 or Str2)
The Question is: Where does my Str1 go?
Upvotes: 0
Views: 39
Reputation: 5564
In both examples, Str1 < Str2
is true, so the same expression (Str1 .. Str2
) gets printed both times. The right operand of or
is ignored because its left operand is true.
Upvotes: 1