You are viewing a single comment's thread from:
RE: SEC S20W03 || Basic Programming Course: Lesson #3 Operations
... you just needed to compare the three results at the same time.
Do you mean something like this one below where result and evaluation are grouped in to one section?
// 3 - The Results and Evaluation;
Print "The value of y is: ", y;
Print "Is " y " greater than or equal to 0? " y>=0;
Print "The value of x is: ", x;
Print "Is " x " greater than or equal to 0? " y>=0;
Print "The value of z is: ", z;
Print "Is " z " greater than or equal to 0? " y>=0;
or
// 4 – Evaluation
Print "Is " y, x, z " greater than or equal to 0? " y>=0;
Thanks, for correction, Professor.
Print "Is " y, x, z " greater than or equal to 0? " y>=0 and x>=0 and z>=0;
Ah Yes! Thank you very much, Professor.
If one of them, lets say x has the value of -78, how would the program return the result? Or should I wait for the next weeks? :D
If any of the three results is false then the whole expression will be false too.
It’s like to say something like: I’m going to sing and dance in the party.
It means that you will sing and dance, both things in the party. So both expressions should be true to say that what you are saying is true
If you say: I’m going to sing or dance in the party.
This means that you could do any of the activities above, but it’s not mandatory, you could only sing but don’t dance and viceversa. So, you if you do one of the both activities then what you said is true because you said you will do one thing or the other thing, but you didn’t confirmed you will do both.
That’s the logic behind this.
If you have any other doubt then let me know!
Ah yess !!
y>=0 and x>=0 and z>=0
The AND operator.
Lesson learned: It's not just about logic but also attention to detail.
Thanks, again, Professor.