Understanding NOT Logic
+20
WiezKhalifa
Asdfghjkl
Jung kook
JULIAN P.A
Ferre
Emie Ligutan
Admin
RicManipon
nyela
ilovebts
Pox
Lawrence
iramae
althea faye
James Navarro
LouiseSebastianeYagi
Sean Monacillo
Luwiezz
niella
justjoking10
24 posters
Understanding NOT Logic
Wed Jul 25, 2018 9:06 am
Using the NOT operator
We use the logical NOT operator to reverse the meaning of a Boolean expression. For example, the following statement outputs Can register to vote when age is greater than or equal to 18:
if NOT (age < 18) then
output "Can register to vote"
endif
This example uses parentheses around the expression age < 18 to show that the NOT operator applies to the entire Boolean expression age < 18. Without the parentheses, some languages might try to evaluate the expression NOT age before testing the less-than comparison. Depending on the programming language, the result would either be incorrect or the statement would not execute at all Quick Reference 1-1 contains the truth table for the NOT operator. As you can see, any expression that would be true without the operator becomes false with it, and any expression that would be false without the operator becomes true with it.
Quick Reference 1-1 NOT Logic Truth Table
You have already learned that arithmetic operators such as + and –, and relational operators such as > and <, are binary operators that require two operands. Unlike those operators, the NOT operator is a unary operator, meaning it takes only one operand—that is, you do not use it between two expressions, but you use it in front of a single expression. As when using the binary not-equal-to comparison operator, using the unary NOT operator can create confusing statements because negative logic is difficult to follow. For example, if your intention is not to allow voter registration for those under 18, then either of the following two statements will accomplish your goal, but the second one is easier to understand:
if NOT (age < 18) then
output "Can register to vote"
endif
if age >= 18 then
output "Can register to vote"
endif
Logic Example
Figure 1-1 A Central Heating System installed inside a house.
For example consider x is 0 when temperature is low, and it is 1 when temperature gets high.
Let's see how the Central Heating system behaves, by the way Central Heating gives more heat to your home when turned on. See the truth table below.
We use the logical NOT operator to reverse the meaning of a Boolean expression. For example, the following statement outputs Can register to vote when age is greater than or equal to 18:
if NOT (age < 18) then
output "Can register to vote"
endif
This example uses parentheses around the expression age < 18 to show that the NOT operator applies to the entire Boolean expression age < 18. Without the parentheses, some languages might try to evaluate the expression NOT age before testing the less-than comparison. Depending on the programming language, the result would either be incorrect or the statement would not execute at all Quick Reference 1-1 contains the truth table for the NOT operator. As you can see, any expression that would be true without the operator becomes false with it, and any expression that would be false without the operator becomes true with it.
Quick Reference 1-1 NOT Logic Truth Table
You have already learned that arithmetic operators such as + and –, and relational operators such as > and <, are binary operators that require two operands. Unlike those operators, the NOT operator is a unary operator, meaning it takes only one operand—that is, you do not use it between two expressions, but you use it in front of a single expression. As when using the binary not-equal-to comparison operator, using the unary NOT operator can create confusing statements because negative logic is difficult to follow. For example, if your intention is not to allow voter registration for those under 18, then either of the following two statements will accomplish your goal, but the second one is easier to understand:
if NOT (age < 18) then
output "Can register to vote"
endif
if age >= 18 then
output "Can register to vote"
endif
Logic Example
Figure 1-1 A Central Heating System installed inside a house.
For example consider x is 0 when temperature is low, and it is 1 when temperature gets high.
Let's see how the Central Heating system behaves, by the way Central Heating gives more heat to your home when turned on. See the truth table below.
Did you UNDERSTAND NOT LOGIC?
If yes, would you please give different example/application of it?
else comment down below your reactions/questions.
If yes, would you please give different example/application of it?
else comment down below your reactions/questions.
- justjoking10Guru
- Posts : 19
Join date : 2018-08-01
Re: Understanding NOT Logic
Wed Aug 01, 2018 7:05 pm
Sir. When should we use the NOT Logic? Because I think it is more convenient for most of us not to use it.
Re: Understanding NOT Logic
Wed Aug 01, 2018 7:16 pm
There's two type of programming, a positive logic and negative logic. If your'e negative logic, this is what you use often. I can tell you that looping is where negative logic is most applied.justjoking10 wrote:Sir. When should we use the NOT Logic? Because I think it is more convenient for most of us not to use it.
- justjoking10Guru
- Posts : 19
Join date : 2018-08-01
Re: Understanding NOT Logic
Wed Aug 01, 2018 7:34 pm
I see Sir. Thank you. But is there a neutral type of programmer? I mean uses positive logic and negative logic in one program?
Re: Understanding NOT Logic
Thu Aug 02, 2018 7:27 am
Not sure if it's called neutral. But yeah you can use both in a program.justjoking10 wrote:I see Sir. Thank you. But is there a neutral type of programmer? I mean uses positive logic and negative logic in one program?
- niella
- Posts : 1
Join date : 2018-08-02
Re: Understanding NOT Logic
Thu Aug 02, 2018 9:29 am
Admin wrote:Not sure if it's called neutral. But yeah you can use both in a program.justjoking10 wrote:I see Sir. Thank you. But is there a neutral type of programmer? I mean uses positive logic and negative logic in one program?
most programmers use NEGATIVE logic because for them when it's not , okay it's not and then end!
Re: Understanding NOT Logic
Thu Aug 02, 2018 9:31 am
Daniella. Is it like "If you don't like you can''t have it."niella wrote:Admin wrote:Not sure if it's called neutral. But yeah you can use both in a program.justjoking10 wrote:I see Sir. Thank you. But is there a neutral type of programmer? I mean uses positive logic and negative logic in one program?
most programmers use NEGATIVE logic because for them when it's not , okay it's not and then end!
- LouiseSebastianeYagiGuru
- Posts : 18
Join date : 2018-08-02
Re: Understanding NOT Logic
Thu Aug 02, 2018 4:55 pm
Sir, is it possible to use and, or, not logic in a program? If it is, will it function properly?
Sent from Topic'it App
Sent from Topic'it App
Re: Understanding NOT Logic
Thu Aug 02, 2018 6:02 pm
Yes it will, if it is logically right.LouiseSebastianeYagi wrote:Sir, is it possible to use and, or, not logic in a program? If it is, will it function properly?
Sent from Topic'it App
- LouiseSebastianeYagiGuru
- Posts : 18
Join date : 2018-08-02
Re: Understanding NOT Logic
Thu Aug 02, 2018 6:43 pm
Sir may instance po na may mga ganung type ng logic?
Sent from Topic'it App
Sent from Topic'it App
- LuwiezzNewbie
- Posts : 3
Join date : 2018-08-02
Re: Understanding NOT Logic
Thu Aug 02, 2018 6:50 pm
Using the NOT logic makes the flowchart or the code clear. With this logic, I think I am able to create a program properly
Re: Understanding NOT Logic
Thu Aug 02, 2018 7:38 pm
This flowchart is a combination of AND and OR Logic. You can incorporate NOT logic or make it to negative logic. How? That's for you to know, can you do it?LouiseSebastianeYagi wrote:Sir may instance po na may mga ganung type ng logic?
Sent from Topic'it App
- Sean MonacilloGuru
- Posts : 19
Join date : 2018-08-02
Re: Understanding NOT Logic
Thu Aug 02, 2018 8:21 pm
Yes, oo naman pre as long as maganda yung pagkakagawa mo sa program mo tsaka tama .LouiseSebastianeYagi wrote:Sir, is it possible to use and, or, not logic in a program? If it is, will it function properly?
Sent from Topic'it App
- LouiseSebastianeYagiGuru
- Posts : 18
Join date : 2018-08-02
Re: Understanding NOT Logic
Thu Aug 02, 2018 8:22 pm
Sa paanong instance nangyayari yun. Oo tama siya pero paano maiaapply yun? Saan?
Sent from Topic'it App
Sent from Topic'it App
- Sean MonacilloGuru
- Posts : 19
Join date : 2018-08-02
Re: Understanding NOT Logic
Thu Aug 02, 2018 8:24 pm
di ko gets yung sa neutral pre pero pwede talaga gumamit ng POSITIVE LOGIC at NEGATIVE LOGIC sa program na gagawin. basta tama lang yung condition na dapat mameetjustjoking10 wrote:I see Sir. Thank you. But is there a neutral type of programmer? I mean uses positive logic and negative logic in one program?
Sent from Topic'it App
- Sean MonacilloGuru
- Posts : 19
Join date : 2018-08-02
Re: Understanding NOT Logic
Thu Aug 02, 2018 8:27 pm
Sa tingin ko dipende yun sa problem. wala naman atang instance na gagawin yun sa ganito lang or ganyan. Nasa Programmer kasi yung kung paano niya iintindihin yung logic niya sa paggawa niya ng program. Maiaapply mo yun dipende sa condition na gusto mo mameetLouiseSebastianeYagi wrote:Sa paanong instance nangyayari yun. Oo tama siya pero paano maiaapply yun? Saan?
Sent from Topic'it App
- Sean MonacilloGuru
- Posts : 19
Join date : 2018-08-02
Re: Understanding NOT Logic
Thu Aug 02, 2018 8:28 pm
kaso nakakalito talaga pre pag positive thinker ka sanayan lang siguro if saan comfortableLuwiezz wrote:Using the NOT logic makes the flowchart or the code clear. With this logic, I think I am able to create a program properly
Sent from Topic'it App
- LouiseSebastianeYagiGuru
- Posts : 18
Join date : 2018-08-02
Re: Understanding NOT Logic
Thu Aug 02, 2018 8:30 pm
Ayun na nga. Pero if possible nga, may instance ba na may nakagawa na nun?
Sent from Topic'it App
Sent from Topic'it App
- Sean MonacilloGuru
- Posts : 19
Join date : 2018-08-02
Re: Understanding NOT Logic
Thu Aug 02, 2018 8:32 pm
I think pre it's up to the programmer nalang kung paano yung takbo ng isip niya sa logic niya. meron din kasi Both eh na kaya mag isip ng positive logic tsaka negative logic. kaya wala naman at sinabi na kung kelan lang siya pwede gamitin sa pagkaka alam ko anytime naman pwede siya gamitin .justjoking10 wrote:Sir. When should we use the NOT Logic? Because I think it is more convenient for most of us not to use it.
Sent from Topic'it App
- Sean MonacilloGuru
- Posts : 19
Join date : 2018-08-02
Re: Understanding NOT Logic
Thu Aug 02, 2018 8:34 pm
Possible pre na may nakagawa na nun . Yung mga malulupit siguro mag isip hahahaLouiseSebastianeYagi wrote:Ayun na nga. Pero if possible nga, may instance ba na may nakagawa na nun?
Sent from Topic'it App
Re: Understanding NOT Logic
Thu Aug 02, 2018 8:34 pm
Again Im not sure if "neutral" is used as a term in proogramming, but yes you can utilize both NEGATIVE and POSITIVE Logic in one program.Sean Monacillo wrote:di ko gets yung sa neutral pre pero pwede talaga gumamit ng POSITIVE LOGIC at NEGATIVE LOGIC sa program na gagawin. basta tama lang yung condition na dapat mameetjustjoking10 wrote:I see Sir. Thank you. But is there a neutral type of programmer? I mean uses positive logic and negative logic in one program?
Sent from Topic'it App
Re: Understanding NOT Logic
Thu Aug 02, 2018 8:37 pm
Sean got the point. Use what logic you want as long as it is working its good. But as an advanced programmer you might be conscious about using POSITIVE nor NEGATIVE Logic because you want your program to be structured.Sean Monacillo wrote:I think pre it's up to the programmer nalang kung paano yung takbo ng isip niya sa logic niya. meron din kasi Both eh na kaya mag isip ng positive logic tsaka negative logic. kaya wala naman at sinabi na kung kelan lang siya pwede gamitin sa pagkaka alam ko anytime naman pwede siya gamitin .justjoking10 wrote:Sir. When should we use the NOT Logic? Because I think it is more convenient for most of us not to use it.
Sent from Topic'it App
- Sean MonacilloGuru
- Posts : 19
Join date : 2018-08-02
Re: Understanding NOT Logic
Thu Aug 02, 2018 8:40 pm
Thank you po sir ! . pero sir pwede naman po siguro na stick nalang po sa positive logic or negative logic sir ? Am I right po ba sir ?Admin wrote:Sean got the point. Use what logic you want as long as it is working its good. But as an advanced programmer you might be conscious about using POSITIVE nor NEGATIVE Logic because you want your program to be structured.Sean Monacillo wrote:I think pre it's up to the programmer nalang kung paano yung takbo ng isip niya sa logic niya. meron din kasi Both eh na kaya mag isip ng positive logic tsaka negative logic. kaya wala naman at sinabi na kung kelan lang siya pwede gamitin sa pagkaka alam ko anytime naman pwede siya gamitin .justjoking10 wrote:Sir. When should we use the NOT Logic? Because I think it is more convenient for most of us not to use it.
Re: Understanding NOT Logic
Thu Aug 02, 2018 8:41 pm
Luwiezz wrote:Using the NOT logic makes the flowchart or the code clear. With this logic, I think I am able to create a program properly
Good to know that you have used NOT Logic. Enjoy programming! Long way to go.
Re: Understanding NOT Logic
Thu Aug 02, 2018 8:43 pm
You'll never know. Change is Constant. Otherwise, you'll experience it whether to use POSITIVE nor NEGATIVE Logic in your future programming.Sean Monacillo wrote:Thank you po sir ! . pero sir pwede naman po siguro na stick nalang po sa positive logic sir ? Am I right po ba sir ?Admin wrote:Sean got the point. Use what logic you want as long as it is working its good. But as an advanced programmer you might be conscious about using POSITIVE nor NEGATIVE Logic because you want your program to be structured.Sean Monacillo wrote:I think pre it's up to the programmer nalang kung paano yung takbo ng isip niya sa logic niya. meron din kasi Both eh na kaya mag isip ng positive logic tsaka negative logic. kaya wala naman at sinabi na kung kelan lang siya pwede gamitin sa pagkaka alam ko anytime naman pwede siya gamitin .justjoking10 wrote:Sir. When should we use the NOT Logic? Because I think it is more convenient for most of us not to use it.
Sent from Topic'it App
Permissions in this forum:
You cannot reply to topics in this forum
|
|