in the video it is written that for logical evaluations any non-zero value is true like 3 or 5 etc
but for logical operations the answer is always zero or one right? how can it be 3 or 5
Theoretical doubt
Hi Riya!
In the video its taught that:
-
Relational and Logical Operators always EQUATE to 0 or 1.
-
For Logical evaluation, any non 0 value is true.
Now, what it means is that the result that you get after applying Logical operators is always 0 or 1 (false or true)
Now logical operators are used to combine conditions, after which we use the truth table to judge the outcome.
Consider this ->
You’re given something like
if(Condition1 && Condtion2 ){
print something…
}
Now you’ll refer to the truth table to judge the outcome, so both Condition1 and condition2 can either be false or true. If Condtion 2 is something like (7-5), it’s 2 and in this case 2 is considered as True.
I have written a small piece of code to elaborate the above fact, please check it out:
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.