comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com (Tom Moran)
Subject: Re: string comparison?
Date: 1997/10/17
Date: 1997-10-17T00:00:00+00:00	[thread overview]
Message-ID: <34478875.1320471@SantaClara01.news.InterNex.Net> (raw)
In-Reply-To: EI5vIH.Et7@seas.ucla.edu


>1.  Is there anyway to do a string comparison in ada?
>    So far, I have done it character by character but I am wondering if there
>    is a better way to do it?  
   subtype Punched_Cards is string(1 ..  80);
   a, b : Punched_Cards;
  ...
  if a = b then ...
 if a < b then ...

>2.  Is there anyway to exit out of a program inside an if-then-else statement?
>    I have a program that waits for a command, and depending on that command,
>    it would do something.  So I thought that the quit command would be 
>    simplest.  But I can't even exit out of the if-then-else block.
  If you want to exit a subroutine, you can do a 'return'.  If you
want to exit from a loop, use 'exit'.  I don't understand what you
might mean by being stuck inside an 'if' block.  Are you trying to
abort the whole program from deep inside some set of subroutines?
Perhaps you want to raise an exception, eg. "raise
Abandon_Ship_Every_Man_For_Himself".  Or do you want to go so far as
to reboot the computer, in which case you will need some OS call
specific to your target environment.   Or if this is an embedded
system and you want to trigger a booby-trap explosive device, the
method will depend on the target hardware.  




      parent reply	other threads:[~1997-10-17  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-16  0:00 string comparison? Tri Tram
1997-10-17  0:00 ` Steve Doiel
1997-10-17  0:00 ` Tom Moran [this message]
replies disabled

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