nested while loop
Kristian Nilssen
knilssen at WEATHER3000.COM
Tue Mar 7 06:22:48 EST 2006
oh yes, doh! The syntax error was due to tabs at the end of a line.
rgds,
Douglas Clark wrote:
> This error is still the one that Bernd indicated:
>
> bernd.becker at METOFFICE.GOV.UK wrote:
>
>> Initialize c=0 in the loop over r?
>>
>
> e.g.
>
> while(r < rows)
> say 'row '%r
> c=0
> while(c < columns)
> say 'column '%c
>
>
>
>
>>>> knilssen at WEATHER3000.COM 07/03/2006 10:54:04 >>>
>>>>
> The following script should produce output which shows that a nested
> loop is executing. However, the inner loop only executes once.
>
> columns = 4
> rows = 5
> c = 0
> r = 0
>
> while(r < rows)
> say 'row '%r
> while(c < columns)
> say 'column '%c
> c = c + 1
> endwhile
> r = r + 1
> endwhile
>
> output...
> row 0
> column 0
> column 1
> column 2
> column 3
> row 1
> row 2
> row 3
> row 4
>
>
> --
> This message (and any attachments) is for the recipient only. NERC
> is subject to the Freedom of Information Act 2000 and the contents
> of this email and any reply you make may be disclosed by NERC unless
> it is exempt from release under the Act. Any material supplied to
> NERC may be stored in an electronic records management system.
>
More information about the gradsusr
mailing list