next up previous contents
Next: for 文 Up: プログラミング Previous: if 文

while 文

octave:25> while (n <= 10)
> s=s+n;
> n=n+1;
> endwhile
octave:26> s
s = 55
octave:35> i = 1;
octave:36> s = 0;
octave:37> while (1)
> if (i > 10)
> break
> endif
> s = s + i;
> i = i + 1;
> endwhile
octave:38> s
s = 55



Toru Sasaki
2001-07-23