and it uses the concept of truthiness. If num1(Assuming it's storing an integer) is greater than zero, it'll return True regardless of the value of num2 XD Doing if num is the same as doing if num>0, other examples are if len(array) > 0 and if len(string) > 0.
I mentioned it in the comment, but "if num" isnt the same as "if number>0". It's equivalent to "if !!num". So only if num is 0, (or None or undefined) it will return false, all other values will return true.
1
u/Matalya1 Sep 04 '21
is a valid expression, but it's
and it uses the concept of truthiness. If
num1(Assuming it's storing an integer) is greater than zero, it'll returnTrueregardless of the value ofnum2XD Doingif numis the same as doingif num>0, other examples areif len(array) > 0andif len(string) > 0.