mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-19 11:23:46 +00:00
24 lines
494 B
Mathematica
24 lines
494 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ft=mercury ff=unix ts=4 sw=4 et
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module state_vars_test1.
|
|
|
|
:- interface.
|
|
|
|
:- pred p(int::in, int::out) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module int.
|
|
|
|
% Illegally refers to !:X in an if-then-else expr.
|
|
%
|
|
p(!X) :-
|
|
!:X = !.X +
|
|
( if max(0, !.X, !:X) then
|
|
1
|
|
else
|
|
2
|
|
).
|