// Or Example
/* Or performs logical and bitwise disjunction */
var Test1, Test2, Test3, x, y;
x = 1;
y = 5;
Test1 = x > 0 || y < 10;
Test2 = x > 0 || y > 10;
Test3 = x || y;
NSB.Print("Logical:");
NSB.Print(" x > 0 || y < 10 = " + Test1);
NSB.Print(" x > 0 || y > 10 = " + Test2);
Or: Difference between revisions
Jump to navigation
Jump to search
(Created page with "''result'' = ''x'' OR ''y'' '''Description''' OR returns the logical disjunction of two expressions. ''result'' is TRUE, if one or both expressions ''x'' and ''y'' evaluate ...") |
No edit summary |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
''result'' = ''x'' | ''result'' = ''x'' Or ''y'' | ||
== Description == | |||
Or returns the logical disjunction of two expressions. ''result'' is TRUE, if one or both expressions ''x'' and ''y'' evaluate to TRUE, otherwise, ''result'' is FALSE. | |||
== Example == | |||
< | <tabber> | ||
JavaScript= | |||
' | <syntaxhighlight lang="JavaScript"> | ||
// Or Example | |||
/* Or performs logical and bitwise disjunction */ | |||
var Test1, Test2, Test3, x, y; | |||
x = 1; | |||
y = 5; | |||
Test1 = x > 0 || y < 10; | |||
Test2 = x > 0 || y > 10; | |||
Test3 = x || y; | |||
NSB.Print("Logical:"); | |||
NSB.Print(" x > 0 || y < 10 = " + Test1); | |||
NSB.Print(" x > 0 || y > 10 = " + Test2); | |||
</syntaxhighlight> | |||
|-| | |||
BASIC= | |||
<syntaxhighlight lang="vb.net"> | |||
Rem Or Example | |||
'Or performs logical and bitwise disjunction | |||
Dim Test1, Test2, Test3, x, y | |||
x = 1 | x = 1 | ||
y = 5 | y = 5 | ||
Test1 = x > 0 | Test1 = x > 0 Or y < 10 | ||
Test2 = x > 0 | Test2 = x > 0 Or y > 10 | ||
Test3 = x OR y | Test3 = x OR y | ||
Print "Logical:" | |||
Print " x > 0 or y < 10 = " & Test1 | |||
Print " x > 0 or y > 10 = " & Test2 | |||
</ | </syntaxhighlight> | ||
</tabber> | |||
== Output == | |||
<pre> | <pre> | ||
Logical: | Logical: | ||
x > 0 | x > 0 or y < 10 = True | ||
x > 0 | x > 0 or y > 10 = True | ||
</pre> | </pre> | ||
== Related Items == | |||
[[and|And]], [[eqv|Eqv]], [[imp|Imp]], [[not|Not]], [[xor|Xor]] | |||
[[Category:Language Reference]] | |||
[[ | [[Category:Logical Operators]] |
Latest revision as of 22:54, 24 July 2019
result = x Or y
Description
Or returns the logical disjunction of two expressions. result is TRUE, if one or both expressions x and y evaluate to TRUE, otherwise, result is FALSE.
Example
Rem Or Example
'Or performs logical and bitwise disjunction
Dim Test1, Test2, Test3, x, y
x = 1
y = 5
Test1 = x > 0 Or y < 10
Test2 = x > 0 Or y > 10
Test3 = x OR y
Print "Logical:"
Print " x > 0 or y < 10 = " & Test1
Print " x > 0 or y > 10 = " & Test2
Output
Logical: x > 0 or y < 10 = True x > 0 or y > 10 = True