help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: While loop error, is not recognized


From: Sahil
Subject: Re: While loop error, is not recognized
Date: Sat, 28 Apr 2018 02:34:42 -0700 (MST)

renzosebs wrote
> Hi, I am trying to make a code in Octave and I don't know why while
> statement
> is not working, is not being recognized as a  block in the function. This
> is
> an image of it, notice how the function is ending with the endwhile, and
> the
> for loop is not in the function, however the for is made as a block, but
> while is not. 
> <http://octave.1599824.n4.nabble.com/file/t372838/Screenshot_20180427_225548.png>
>  
> 
> If anyone can explain why this is happening, I will be vary grateful. 
> 
> 
> 
> --
> Sent from:
> http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

Hi 
You haven't indented your code properly, that's the reason you're seeing it
closing at endwhile. While loop works well for me, the problem lies in
fprintf's syntax. If no FID is provided, it behaves exactly like printf().
So you should be doing fprintf("%d\n",z) instead. See the attached
screenshot for more.


<http://octave.1599824.n4.nabble.com/file/t372663/pp.png> 



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]