Friday 23 March 2018

Logical Operators

There are only three logical operators which are related with the logical decision.These are listed in the following table-
First two operators are used to combine the conditions i.e. to form a compound conditional expression.Third operator is used to inverse the condition.
For example,
 x > y && k !=b12

This is termed as the logical expression.Whole expression also returns the Boolean value.That is, the above expression will return true when the both the conditions (x > y) and (k!=12) are true.If any one of these condition is false the expression will return false.

Consider another example,
m==99 || j <=10
This logical expression involves the logical OR operator.The expression will return true only when any one of the conditions (m==99 and j<=10) is true.If both condition are false, the whole expression will also expression will return false.

The third operator is know as logical NOT operator.This is the only unary logical operator and generally used to negate the condition.If we write this operator in front of any other relational or logical expression, the result of the expression will be inverted.That is, true will become false and false will become true.

For example,
x = 36 then
! (x > 40) will return true
! (x == 36) will return false
The following program will clear the idea of logical operators and expression.


Post a Comment

Popular Posts


AI (27) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (118) C (77) C# (12) C++ (82) Course (62) Coursera (180) Cybersecurity (22) data management (11) Data Science (95) Data Strucures (6) Deep Learning (9) Django (6) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (6) flutter (1) FPL (17) Google (19) Hadoop (3) HTML&CSS (46) IBM (25) IoT (1) IS (25) Java (92) Leet Code (4) Machine Learning (44) Meta (18) MICHIGAN (5) microsoft (4) Pandas (3) PHP (20) Projects (29) Python (753) Python Coding Challenge (230) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (2) Software (17) SQL (40) UX Research (1) web application (8)


Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses