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

Understanding OR Logic

on Wed Jul 25, 2018 9:05 am
Using the OR Operator
If you need to take action when either one or the other of two conditions is met, you can use two separate, nested selection structures, as in the previous examples. However, most programming languages allow you to make two or more decisions in a single comparison by using a conditional OR operator (or simply the OR operator).

When you use the logical OR operator, only one of the listed conditions must be met for the resulting action to take place. Quick reference 2-1 contains the truth table for the OR operator. As you can see in the table, the entire expression x OR y is false only when x and y each are false individually.


Quick reference 2-1 OR Logic Truth Table


For example, suppose the cell phone company has established a new fee schedule as follows: The basic monthly service bill is $30. An additional $20 is billed to customers who make more than 100 calls or send more than 200 text messages.



If the programming language you use supports the OR operator, you still must realize that the comparison you place first is the expression that will be evaluated first, and cases that pass the test of the first comparison will not proceed to the second comparison. As with the AND operator, this feature is called short-circuiting. The computer can ask only one question at a time; even when you write code as shown at the top of Figure 2-1, the computer will execute the logic shown at the bottom.

[/color]

Figure 2-1 Using an OR operator and the logic behind it


Logic Example


Figure 2-2 An automatic Glass Door

Let's say people GOING IN is x(considered 1 when a man is sensed and 0 if none), those who are GOING OUT is y(considered 1 when a man is sensed and 0 if none), and the movement of the door is the result(considered 1 when it opens and 0 if not).

With that, I have made this truth table.


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

?

on Wed Aug 01, 2018 6:18 pm
The topic is very well explained but sir, naguguluhan lang ako, anong pinagkaiba niya sa While Statement? Yun po kasi ang hindi ko mapagtanto Suspect Suspect
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Re: Understanding OR Logic

on Wed Aug 01, 2018 6:28 pm
rheigne wrote:The topic is very well explained but sir, naguguluhan lang ako, anong pinagkaiba niya sa While Statement? Yun po kasi ang hindi ko mapagtanto Suspect Suspect

yung while eh ginagamit sa looping, hindi pa naman tayo nagloloop dito ✌️
Guru
Posts : 19
Join date : 2018-08-01
View user profile

Re: Understanding OR Logic

on Wed Aug 01, 2018 6:36 pm
rheigne wrote:The topic is very well explained but sir, naguguluhan lang ako, anong pinagkaiba niya sa While Statement? Yun po kasi ang hindi ko mapagtanto Suspect Suspect

Ang topic ni sir dito ay about selection. S looping p ung while statement.
jander
Guest

Re: Understanding OR Logic

on Wed Aug 01, 2018 6:52 pm
This topic is very nice, sir you're a great teacher,but I do not understand much, I'm a little confused, but I try my best to understand.
Guru
Posts : 19
Join date : 2018-08-01
View user profile

Re: Understanding OR Logic

on Wed Aug 01, 2018 6:58 pm
The topic is very well explained sir.
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Re: Understanding OR Logic

on Wed Aug 01, 2018 7:07 pm
justjoking10 wrote:The topic is very well explained sir.
That's good to know from you. Are you sure you understand? Can you give another example?
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Re: Understanding OR Logic

on Thu Aug 02, 2018 7:42 am
jander wrote:This topic is very nice, sir you're a great teacher,but I do not understand much, I'm a little confused, but I try my best to understand.
I will also give my best for you to understand. What part are you confused?
Newbie
Posts : 3
Join date : 2018-08-02
View user profile

I LOVE IT

on Thu Aug 02, 2018 6:48 pm
Thank you for posting this, a big help for me understanding OR logic. I will assure you that I will perform well the next time
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Re: Understanding OR Logic

on Thu Aug 02, 2018 7:37 pm
Luwiezz wrote:Thank you for posting this, a big help for me understanding OR logic. I will assure you that I will perform well the next time
Good to know that this forum helps you. You can share this to your friends to let them know and understand OR Logic too.
Guru
Posts : 19
Join date : 2018-08-02
View user profile

Re: Understanding OR Logic

on Thu Aug 02, 2018 8:18 pm
Regarding sa tanong ni rheign 😊 . Yung WHILE STATEMENT sa loop yun rheign tapos kapag OR LOGIC ang gamit mo lang jan is yung IF STATEMENT . pero pwede ka din naman ata mag OR LOGIC SA WHILE LOOP I guess. di lang ako sure sana masagot ni sir if pwede . hehehe 😂 .

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

Re: Understanding OR Logic

on Thu Aug 02, 2018 8:45 pm
Admin wrote:
justjoking10 wrote:The topic is very well explained sir.
That's good to know from you. Are you sure you understand? Can you give another example?

Pamasahe po s jeep.

if customer is Senior OR Student then
WITH DISCOUNT
else
NO DISCOUNT
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Re: Understanding OR Logic

on Thu Aug 02, 2018 8:53 pm
Sean Monacillo wrote:Regarding sa tanong ni rheign 😊 . Yung WHILE STATEMENT sa loop yun rheign tapos kapag OR LOGIC ang gamit mo lang jan is yung IF STATEMENT . pero pwede ka din naman ata mag OR LOGIC SA WHILE LOOP I guess. di lang ako sure sana masagot ni sir if pwede .  hehehe 😂 .

Sent from Topic'it App
Yes you can incorporate OR in a Loop.
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Re: Understanding OR Logic

on Thu Aug 02, 2018 8:54 pm
justjoking10 wrote:
Admin wrote:
justjoking10 wrote:The topic is very well explained sir.
That's good to know from you. Are you sure you understand? Can you give another example?

Pamasahe po s jeep.

if customer is Senior OR Student then
WITH DISCOUNT
else
NO DISCOUNT
Very Good. Ang nagkakagulo ngayon dyan eh yung process after that, diba 20% ang discount so magkano dapat ang binabayad ng STUDENT or SENIOR?
Guru
Posts : 19
Join date : 2018-08-01
View user profile

Re: Understanding OR Logic

on Thu Aug 02, 2018 8:57 pm
Admin wrote:
justjoking10 wrote:
Admin wrote:
justjoking10 wrote:The topic is very well explained sir.
That's good to know from you. Are you sure you understand? Can you give another example?

Pamasahe po s jeep.

if customer is Senior OR Student then
WITH DISCOUNT
else
NO DISCOUNT
Very Good. Ang nagkakagulo ngayon dyan eh yung process after that, diba 20% ang discount so magkano dapat ang binabayad ng STUDENT or SENIO??

9 pesos is the minimum fare.
9 * 0.20 = 1.80.
9 - 1.80 = 7.20
Round to 7
Pero sir mas maikli po sya pag ganto.
9 * 0.80 = 7.20
Round to 7
Guru
Posts : 19
Join date : 2018-08-02
View user profile

Re: Understanding OR Logic

on Thu Aug 02, 2018 8:58 pm
Admin wrote:
Sean Monacillo wrote:Regarding sa tanong ni rheign 😊 . Yung WHILE STATEMENT sa loop yun rheign tapos kapag OR LOGIC ang gamit mo lang jan is yung IF STATEMENT . pero pwede ka din naman ata mag OR LOGIC SA WHILE LOOP I guess. di lang ako sure sana masagot ni sir if pwede .  hehehe 😂 .

Yes you can incorporate OR in a Loop.
Thank you sir 😊 tama na yung nasa isip ko hehehe

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

Re: Understanding OR Logic

on Thu Aug 02, 2018 8:58 pm
justjoking10 wrote:
Admin wrote:
justjoking10 wrote:
Admin wrote:
justjoking10 wrote:The topic is very well explained sir.
That's good to know from you. Are you sure you understand? Can you give another example?

Pamasahe po s jeep.

if customer is Senior OR Student then
WITH DISCOUNT
else
NO DISCOUNT
Very Good. Ang nagkakagulo ngayon dyan eh yung process after that, diba 20% ang discount so magkano dapat ang binabayad ng STUDENT or SENIO??

9 pesos is the minimum fare.
9 * 0.20 = 1.80.
9 - 1.80 = 7.20
Round to 7
Pero sir mas maikli po sya pag ganto.
9 * 0.80  = 7.20
Round to 7
Yun nga ehh kaso "may mga ilan", na driver na 8 ang singil.
Guru
Posts : 10
Join date : 2018-08-07
View user profile

Re: Understanding OR Logic

on Tue Aug 07, 2018 8:45 am
What is the purpose of logic gates?
Guru
Posts : 10
Join date : 2018-08-07
View user profile

Re: Understanding OR Logic

on Tue Aug 07, 2018 8:46 am
What is the purpose of logic gates?
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Re: Understanding OR Logic

on Tue Aug 07, 2018 9:05 am
althea faye wrote:What is the purpose of logic gates?
It used to create a wider and specific logic. Logic gates can be found in an IC, and a group of IC is a huge contribution to build a computer.
Guru
Posts : 10
Join date : 2018-08-07
View user profile

Re: Understanding OR Logic

on Tue Aug 07, 2018 9:39 am
Luwiezz wrote:Thank you for posting this, a big help for me understanding OR logic. I will assure you that I will perform well the next time
it can help a lot for us inspiring programmers . Very Happy Very Happy Very Happy
Guru
Posts : 10
Join date : 2018-08-08
View user profile

Re: Understanding OR Logic

on Wed Aug 08, 2018 7:59 am
Ang Boolean expressions ang hindi talaga nawawala pagdating sa programming. Parang yun na din kase yung basis kung pano tatakbo yung program.
avatar
Admin
Posts : 132
Join date : 2018-07-25
View user profilehttp://jmdomain.forumotion.asia

Re: Understanding OR Logic

on Wed Aug 08, 2018 8:27 am
iramae wrote:Ang Boolean expressions ang hindi talaga nawawala pagdating sa programming. Parang yun na din kase yung basis kung pano tatakbo yung program.
Yes, in computing its a matter of True or False, On or Off, 1 or 0. Very Happy
avatar
Guru
Posts : 10
Join date : 2018-08-11
View user profile

Re: Understanding OR Logic

on Sat Aug 11, 2018 6:29 pm
rheigne wrote:The topic is very well explained but sir, naguguluhan lang ako, anong pinagkaiba niya sa While Statement? Yun po kasi ang hindi ko mapagtanto Suspect Suspect
i think yung while is for looping lang siya Smile
avatar
Guru
Posts : 10
Join date : 2018-08-11
View user profile

Re: Understanding OR Logic

on Sat Aug 11, 2018 6:34 pm
Admin wrote:
justjoking10 wrote:The topic is very well explained sir.
That's good to know from you. Are you sure you understand? Can you give another example?
sir pwede po siguro example po yung sa pag gigitara sir. if gusto po natin matuto mag gitara. dalawang choices po bale its either na hihiram tayo ng gitara OR bibili po ng gitara. it means po kahit san po sa dalawa, matuto ka padin po mga gitara Smile
Sponsored content

Re: Understanding OR Logic

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