octave-maintainers
[Top][All Lists]
Advanced

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

Style question


From: Kim Hansen
Subject: Style question
Date: Fri, 27 Apr 2007 10:01:31 +0200

When working on sub2ind I noticed that it was written in this style
(pseudo code):

if (no_error1)
 if (no_error2)
   do stuff
 else
   error(message 2)
 endif
else
 error(message 1)
endif

In sub2ind there were 4 error checks like this inside each other, and
I found it difficult to read compared to this style:

if (error1)
 error(message 1)
endif
if (error2)
 error(message 2)
endif
do stuff

Are there performance issues or other reasons for the first style?

--
Kim Hansen
Vadgårdsvej 3, 2.tv
2860 Søborg
Fastnet: 3956 2437  --  Mobil: 3091 2437



reply via email to

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