Whats the difference between "and" and "or"??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Whats the difference between "and" and "or"???

if u want yo put two booleans on the same líne, you can write and,so it wil tell you true or false, and you can write or, but it gives you the same output.Whats the difference??

28th Dec 2016, 9:43 PM
Diego Gil-Navarro Urrea
Diego Gil-Navarro Urrea - avatar
5 Answers
+ 4
And is if ___ and ___ have the same value, then do ____. Or is ___ or ___. So or is one or the other, and is both of them.
28th Dec 2016, 9:52 PM
iiRosie1
iiRosie1 - avatar
+ 1
And means that both A and B are true for the entire statement to be true. Here is a quick truth table A. B 0. 0 0. 1 1. 0 1. 1 For both A and B to be true both must be 1, which is our AND statement. OR is either one or the other is true, so if A is true then the entire statement is true. Same with B, if it is true then the entire statement is true regardless of the other condition.
28th Dec 2016, 9:46 PM
Greg Ortiz
Greg Ortiz - avatar
+ 1
and return true if both are true. or return true if either one is true
28th Dec 2016, 9:47 PM
Gustavo Luis
Gustavo Luis - avatar
+ 1
thank you so much
28th Dec 2016, 9:48 PM
Diego Gil-Navarro Urrea
Diego Gil-Navarro Urrea - avatar
+ 1
it really helped me
28th Dec 2016, 9:48 PM
Diego Gil-Navarro Urrea
Diego Gil-Navarro Urrea - avatar