Share
Go down
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Understanding NOT Logic

on 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.



Did you UNDERSTAND NOT LOGIC?
If yes, would you please give different example/application of it?
        else comment down below your reactions/questions.
Guru
Posts : 19
Join date : 2018-08-01
View user profile

Re: Understanding NOT Logic

on 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.
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Re: Understanding NOT Logic

on Wed Aug 01, 2018 7:16 pm
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.
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.
Guru
Posts : 19
Join date : 2018-08-01
View user profile

Re: Understanding NOT Logic

on 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?
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Re: Understanding NOT Logic

on Thu Aug 02, 2018 7:27 am
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?
Not sure if it's called neutral.  But yeah you can use both in a program.
avatar
Posts : 1
Join date : 2018-08-02
View user profile

Re: Understanding NOT Logic

on Thu Aug 02, 2018 9:29 am
Admin wrote:
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?
Not sure if it's called neutral.  But yeah you can use both in a program.

most programmers use NEGATIVE logic because for them when it's not , okay it's not and then end! Cool
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Re: Understanding NOT Logic

on Thu Aug 02, 2018 9:31 am
niella wrote:
Admin wrote:
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?
Not sure if it's called neutral.  But yeah you can use both in a program.

most programmers use NEGATIVE logic because for them when it's not , okay it's not and then end! Cool
Daniella. Is it like "If you don't like you can''t have it." Very Happy
avatar
Guru
Posts : 18
Join date : 2018-08-02
View user profile

Re: Understanding NOT Logic

on 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
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Re: Understanding NOT Logic

on Thu Aug 02, 2018 6:02 pm
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
Yes it will, if it is logically right.
avatar
Guru
Posts : 18
Join date : 2018-08-02
View user profile

Re: Understanding NOT Logic

on Thu Aug 02, 2018 6:43 pm
Sir may instance po na may mga ganung type ng logic?

Sent from Topic'it App
Newbie
Posts : 3
Join date : 2018-08-02
View user profile

Re: Understanding NOT Logic

on 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
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Re: Understanding NOT Logic

on Thu Aug 02, 2018 7:38 pm
LouiseSebastianeYagi wrote:Sir may instance po na may mga ganung type ng logic?

Sent from Topic'it App
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?
Guru
Posts : 19
Join date : 2018-08-02
View user profile

Re: Understanding NOT Logic

on Thu Aug 02, 2018 8:21 pm
LouiseSebastianeYagi wrote:Sir, is it possible to use and, or, not logic in a program? If it is, will it function properly?

Yes, oo naman pre as long as maganda yung pagkakagawa mo sa program mo tsaka tama .

Sent from Topic'it App
avatar
Guru
Posts : 18
Join date : 2018-08-02
View user profile

Re: Understanding NOT Logic

on 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
Guru
Posts : 19
Join date : 2018-08-02
View user profile

Re: Understanding NOT Logic

on Thu Aug 02, 2018 8:24 pm
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?
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 mameet

Sent from Topic'it App
Guru
Posts : 19
Join date : 2018-08-02
View user profile

Re: Understanding NOT Logic

on Thu Aug 02, 2018 8:27 pm
LouiseSebastianeYagi wrote:Sa paanong instance nangyayari yun. Oo tama siya pero paano maiaapply yun? Saan?

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 mameet

Sent from Topic'it App
Guru
Posts : 19
Join date : 2018-08-02
View user profile

Re: Understanding NOT Logic

on Thu Aug 02, 2018 8:28 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
kaso nakakalito talaga pre pag positive thinker ka 😂 sanayan lang siguro if saan comfortable

Sent from Topic'it App
avatar
Guru
Posts : 18
Join date : 2018-08-02
View user profile

Re: Understanding NOT Logic

on 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
Guru
Posts : 19
Join date : 2018-08-02
View user profile

Re: Understanding NOT Logic

on Thu Aug 02, 2018 8:32 pm
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.
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 .

Sent from Topic'it App
Guru
Posts : 19
Join date : 2018-08-02
View user profile

Re: Understanding NOT Logic

on Thu Aug 02, 2018 8:34 pm
LouiseSebastianeYagi wrote:Ayun na nga. Pero if possible nga, may instance ba na may nakagawa na nun?

Possible pre na may nakagawa na nun . Yung mga malulupit siguro mag isip hahaha 😂

Sent from Topic'it App
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Re: Understanding NOT Logic

on Thu Aug 02, 2018 8:34 pm
Sean Monacillo wrote:
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?
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 mameet

Sent from Topic'it App
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.
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Re: Understanding NOT Logic

on Thu Aug 02, 2018 8:37 pm
Sean Monacillo wrote:
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.
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 .

Sent from Topic'it App
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.
Guru
Posts : 19
Join date : 2018-08-02
View user profile

Re: Understanding NOT Logic

on Thu Aug 02, 2018 8:40 pm
Admin wrote:
Sean Monacillo wrote:
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.
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 .

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.
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 ?



Last edited by Sean Monacillo on Thu Aug 02, 2018 8:43 pm; edited 1 time in total
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Re: Understanding NOT Logic

on 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.
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Re: Understanding NOT Logic

on Thu Aug 02, 2018 8:43 pm
Sean Monacillo wrote:
Admin wrote:
Sean Monacillo wrote:
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.
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 .

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.
Thank you po sir ! 😊 . pero sir pwede naman po siguro na stick nalang po sa positive logic sir ? Am I right po ba sir ?

Sent from Topic'it App
You'll never know. Change is Constant. Otherwise, you'll experience it whether to use POSITIVE nor NEGATIVE Logic in your future programming.
Sponsored content

Re: Understanding NOT Logic

Back to top
Permissions in this forum:
You cannot reply to topics in this forum