Logical operations: Difference between revisions

added OpenEdge solution
(add language: Retro)
(added OpenEdge solution)
Line 733:
test(true, false);
test(false, true);</lang>
 
=={{header|OpenEdge/Progress}}==
The logical data type can have three values: true, false or unknown (represented by question mark).
 
<lang progress>FUNCTION testLogical RETURNS CHAR (
i_l1 AS LOGICAL,
i_l2 AS LOGICAL
):
 
RETURN
SUBSTITUTE( '&1 and &2: &3', i_l1, i_l2, i_l1 AND i_l2 ) + '~n' +
SUBSTITUTE( '&1 or &2: &3', i_l1, i_l2, i_l1 OR i_l2 ) + '~n' +
SUBSTITUTE( 'not &1: &2', i_l1, NOT i_l1 )
.
 
END FUNCTION.</lang>
<lang progress>MESSAGE
testLogical( FALSE, FALSE ) SKIP(1)
testLogical( FALSE, TRUE ) SKIP(1)
testLogical( TRUE, FALSE ) SKIP(1)
testLogical( TRUE, TRUE ) SKIP(2)
 
testLogical( ?, ? ) SKIP(1)
testLogical( ?, FALSE ) SKIP(1)
testLogical( ?, TRUE ) SKIP(1)
VIEW-AS ALERT-BOX.</lang>
 
Output
 
<pre>---------------------------
Message (Press HELP to view stack trace)
---------------------------
no and no: no
no or no: no
not no: yes
 
no and yes: no
no or yes: yes
not no: yes
 
yes and no: no
yes or no: yes
not yes: no
 
yes and yes: yes
yes or yes: yes
not yes: no
 
 
? and ?: ?
? or ?: ?
not ?: ?
 
? and no: no
? or no: ?
not ?: ?
 
? and yes: ?
? or yes: yes
not ?: ?
 
---------------------------
OK Help
---------------------------</pre>
 
=={{header|Oz}}==
73

edits