[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Scripting language takes a silicon turn
- From: Boyko Bantchev <boykobb@...>
- Date: Thu, 26 Jan 2006 14:50:13 +0200
On 1/26/06, Lisa Parratt <lisa@thecommune.org.uk> wrote:
> Mark Edgar wrote:
> > loop
> > line = io.read()
> > while line
> > io.write(line)
> > repeat
>
> Is that similar to Ada's:
>
> loop
> exit when /condition/;
> end loop;
>
> ? It always struck me as an exceedingly beautiful way of making all the
> different sorts of loop disappear up themselves.
Not exactly. In Ada, you can use exit-when- or just exit
in any of the `loop', `for', and `while' constructs. But exit is not
a part of the syntax of any of these, so you don't have to use it.
Moreover, the exit can be nested in an `if', a block, or another
loop that is itself a part of the loop being exited. In effect, exit
is nothing more than what the if-break is in C.
Forth's begin-while-repeat, on the other hand, is a true
n-and-a-half loop.
- References:
- Scripting language takes a silicon turn, Vijay Aswadhati
- Re: Scripting language takes a silicon turn, Chris Marrin
- Re: Scripting language takes a silicon turn, Keith Wiles
- Re: Scripting language takes a silicon turn, Alen Ladavac
- Re: Scripting language takes a silicon turn, mnewberry
- Re: Scripting language takes a silicon turn, Tom Reahard
- Re: Scripting language takes a silicon turn, Brian Weed
- Re: Scripting language takes a silicon turn, Walter Cruz
- Re: Scripting language takes a silicon turn, Mark Edgar
- Re: Scripting language takes a silicon turn, Lisa Parratt