Undefined values: Difference between revisions

Content added Content deleted
(→‎{{header|Python}}: Modified comments to stress creation/deletion. There is no 'undefined' value to give.)
m (→‎[[Undefined values#ALGOL 68]]: rename some variables)
Line 9: Line 9:


Note: Some implementations (eg [[ALGOL 68C]]) also have a procedure named ''undefined'' that is called to indicated that the behaviour at a particular point in a program is unexpected, undefined, or non-standard.
Note: Some implementations (eg [[ALGOL 68C]]) also have a procedure named ''undefined'' that is called to indicated that the behaviour at a particular point in a program is unexpected, undefined, or non-standard.
<lang algol68>MODE X = REAL;
<lang algol68>MODE R = REF REAL;
REF X x := NIL;
R r := NIL;


MODE U = UNION(COMPL, VOID);
MODE U = UNION(COMPL, VOID);
U u := EMPTY;
U u := EMPTY;


IF x IS REF X(NIL) THEN
IF r IS R(NIL) THEN
print(("x IS NIL", new line))
print(("r IS NIL", new line))
ELSE
ELSE
print(("x ISNT NIL", new line))
print(("r ISNT NIL", new line))
FI;
FI;


Line 24: Line 24:
(VOID):print(("u is EMPTY", new line))
(VOID):print(("u is EMPTY", new line))
OUT print(("u isnt EMPTY", new line))
OUT print(("u isnt EMPTY", new line))
ESAC</lang>
ESAC
</lang>
Output:
Output:
<pre>
<pre>
x IS NIL
r IS NIL
u is EMPTY
u is EMPTY
</pre>
</pre>