comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: whats semicolon?
Date: 23 Oct 2003 22:33:13 +0100
Date: 2003-10-23T22:33:13+01:00	[thread overview]
Message-ID: <x7vfzhj7i7a.fsf@smaug.pushface.org> (raw)
In-Reply-To: 3F983E65.2080407@terra.es

"@{-_-}@" <nuhvok@terra.es> writes:

> Im triying to develop a code in ADA.  Im a newbie :).  This code must
> ouput a series number.
> 
> If I try a number N lagger than nought the program must ouput a
> progressive series number from 1 as far as N.
> 
> If I try a number N smaller than nought, the program must output a
> progressive series number from -1 as far as N.
> 
> If I try nouth the program must output "ZERO".
> 
> I tried the following intructions:
> 
> with Text_Io, Ada.Integer_Text_IO;
> use Text_Io, Ada.Integer_Text_IO;
> 
> procedure Practica1 is
> 
> n: integer;
> c: integer :=0;
> 
> begin
> 
> 	put ("Escribe un numero entero: ");
> 	get (n);
> 	if n = 0 then
> 
> 		put("cero")
> 
> 	else
> 	
> 		IF N > 0 then
> 			for c in 0..n loop
> 				put (c);
> 			end loop
> 		else
> 			for c in -1..n loop
> 				put (c);
> 			end loop
> 		end if
> 	
> 	end if
> 
> end Practica1;
> 
> When I try to compile it, the objectada show the following error:
> 
> practica1.adb: Error: line 20 col 2 Parse error: expected SEMICOLON,
> got ELSE, Inserting SEMICOLON
> 
> Whats SEMICOLON?

;

In Ada, the semicolon is a terminator not a separator.

   if n = 0 then
     put ("cero");
   else

(can you see that this fails to meet your requirements as stated in at
least two respects?)

Same semicolon problem later on at end loop;  end if; .

-- 
Simon Wright                               100% Ada, no bugs.



  reply	other threads:[~2003-10-23 21:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-23 20:47 whats semicolon? @{-_-}@
2003-10-23 21:33 ` Simon Wright [this message]
2003-10-23 23:32 ` Ludovic Brenta
2003-10-23 23:56   ` Martin Dowie
2003-10-24  1:19   ` Jeffrey Carter
2003-10-24 13:28   ` Preben Randhol
2003-10-24 14:34     ` Martin Dowie
2003-10-24 15:10       ` Preben Randhol
2003-10-24 17:20         ` Martin Dowie
     [not found] ` <n2mm61-fg3.ln1@beastie.ix.netcom.com>
2003-10-24 20:06   ` Simon Wright
2003-10-25 13:39 ` Roberto Waltman
replies disabled

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