comp.lang.ada
 help / color / mirror / Atom feed
From: carllp@freja.dk (Carl-Lykke Pedersen)
Subject: Re: Ada exceptions
Date: 9 Sep 88 16:57:17 GMT	[thread overview]
Message-ID: <4055@freja.dk> (raw)
In-Reply-To: 5701@utah-cs.UUCP

u-dmfloy%sunset.utah.edu@utah-cs.UUCP (Daniel M Floyd) writes:
>I've had two messages that say "go Ada".

"Go (PL/1), MESA, CLU, ML"

PL/1:
     FACTORIAL: PROCEDURE;
	DECLARE (N, F) FIXED FIN (31) INIT (1);
	ON FINISH BEGIN;
	  PUT LIST (N, "FACTORIAL =", F);
	  PUT SKIP;
	  N = N + 1;
	  F = N * F;
	  STOP;
	  END;
	STOP;
     END FACTORIAL;

Ada:
     function DIVIDE_CHECK(X, Y: REAL) return REAL is
	begin
	  if X = 0 then
		raise SILLY;
	  else X/Y;
	  endif;
	exception
	  when NUMERIC_ERROR => return 0;
	  when SILLY => return -1;
     end;

Sorry if the syntax isn't correct. I do not have an Ada-compiler (or a PL/1-
compiler).

Regards
CLp
.

  parent reply	other threads:[~1988-09-09 16:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1988-09-06 22:07 Real time environment w/ 300K+ lines? MFHorn
1988-09-07  9:01 ` Ada exceptions Daniel M Floyd
1988-09-07 22:28   ` Robert Eachus
1988-09-09 16:57   ` Carl-Lykke Pedersen [this message]
1988-09-12 16:10     ` Robert Eachus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox