Imp: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
No edit summary
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
''Result'' = ''x'' IMP ''y''
''This function is for BASIC compatibility. It is not available in pure JavaScript projects.''  


'''Description'''
''Result'' = ''x'' Imp ''y''


IMP returns the logical implication of two expressions. Logical implication returns TRUE if ''x'' implies ''y''. IMP also does a bitwise comparison of two numeric expressions.
== Description ==
 
Imp returns the logical implication of two expressions. Logical implication returns TRUE if ''x'' implies ''y''. Imp also does a bitwise comparison of two numeric expressions.


'''Table 13: Logical Implication'''
'''Table 13: Logical Implication'''
Line 20: Line 22:
|}
|}


'''Example'''
== Example (Basic) ==


<pre>
<pre>
REM IMP Example
Rem Imp Example
'IMP preforms logical and bitwiseimplication
'Imp preforms logical and bitwise implication
DIM Test1, Test2, Test3, x, y
Dim Test1, Test2, Test3, x, y
x = 3
x = 3
y = 5
y = 5
Test1 = x < 0 IMP y < 10
Test1 = x < 0 Imp y < 10
Test2 = x > 0 IMP y > 10
Test2 = x > 0 Imp y > 10
Test3 = x < 0 IMP y > 10
Test3 = x < 0 Imp y > 10
PRINT "Logical:"
Print "Logical:"
PRINT "  x < 0 IMP y < 10 = " & Test1
Print "  x < 0 Imp y < 10 = " & Test1
PRINT "  x > 0 IMP y > 10 = " & Test2
Print "  x > 0 Imp y > 10 = " & Test2
PRINT "  x < 0 IMP y > 10 = " & Test3
Print "  x < 0 Imp y > 10 = " & Test3
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
Line 46: Line 48:
</pre>
</pre>


'''Related Items'''
== Related Items ==


[[and|AND]], [[eqv|EQV]], [[not|NOT]], [[or|OR]], [[xor|XOR]]
[[and|And]], [[eqv|Eqv]], [[not|Not]], [[or|Or]], [[xor|Xor]]


[[Category:Language Reference]]
[[Category:Language Reference]]


[[Category:Logical Operators]]
[[Category:Logical Operators]]

Latest revision as of 17:35, 24 March 2019

This function is for BASIC compatibility. It is not available in pure JavaScript projects.

Result = x Imp y

Description

Imp returns the logical implication of two expressions. Logical implication returns TRUE if x implies y. Imp also does a bitwise comparison of two numeric expressions.

Table 13: Logical Implication

x y Implication
True/1 True/1 True/1
True/1 False/0 False/0
False/0 True/1 True/1
False/0 False/0 True/1

Example (Basic)

Rem Imp Example
'Imp preforms logical and bitwise implication
Dim Test1, Test2, Test3, x, y
x = 3
y = 5
Test1 = x < 0 Imp y < 10
Test2 = x > 0 Imp y > 10
Test3 = x < 0 Imp y > 10
Print "Logical:"
Print "  x < 0 Imp y < 10 = " & Test1
Print "  x > 0 Imp y > 10 = " & Test2
Print "  x < 0 Imp y > 10 = " & Test3

Output

Logical:
  x < 0 IMP y < 10 = True
  x > 0 IMP y > 10 = False
  x < 0 IMP y > 10 = True

Related Items

And, Eqv, Not, Or, Xor