| Re: Star Trek by Krishna Myneni |
|
 |
|
 |
|
 |
|
 |
Group: comp.lang.forth · Group Profile
Author: Doug HoffmanDoug Hoffman Date: Sep 19, 2008 08:51
The Beez' wrote:
> Krishna,
>
> Are you SURE this is correct? I think this goes out of bounds for the
> n{ array!
>
> ---8<---
> 3 INTEGER array n{
> : LongRangeSensors ( -- )
> d{ 3 } f@ f0< IF
> cr ." LONG RANGE SENSORS ARE INOPERABLE"
> ELSE
> cr ." LONG RANGE SCAN FOR QUADRANT " q1 ? ." ," q2 ?
> cr ." ------------" cr
> q1 @ 2 + q1 @ 1- DO
> -1 n{ 1 } !
> -2 n{ 2 } !
> -3 n{ 3 } !
> ---8<---
>
> Hans Bezemer
I always use arrays that self check for out of bounds indices, but only
during development. Once the program is debugged the check is removed.
-Doug
|