Logical Operators in Hindi
Logical Operators तीन प्रकार के होते है |
| Operators | Description |
|---|---|
| &&(and) | AND |
| ||(or) | OR |
| ! | NOT |
Example for &&(and) Logical Operator
&& operator के साथ दिए हुए दोनों conditions अगर true होते है तो ये true return करता है | '&&' operator के बजाय 'and' को भी लिखा जाता है |
Source Code :Output :1234567<?php
$a = 5;
$b = 6;
if(($a < $b) || ($a > $b))
echo "logic is true.";
?>
logic is true.
Example for ||(or) Logical Operator
|| operator के साथ दिए हुए दोनों conditions में से अगर एक भी condition true होती को तो ये true return करता है | '||' operator के बजाय 'or' को भी लिखा जाता है |
Source Code :Output :1234567<?php
$a = 5;
$b = 6;
if(($a < $b) || ($a > $b))
echo "logic is true.";
?>
logic is true.
Example for ! Logical Operator
Program में अगर condition false है तो ! operator से logic true हो जाता है | अगर condition true है तो ! operator से logic false किया जाता है |
Source Code :Output :1234567<?php
$a = 5;
$b = 6;
if(!($a > $b))
echo "logic is true.";
?>
logic is true.
0 comments:
Post a Comment
Thanks