lua-users home
lua-l archive

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


On Tue, 26 Jan 2010 15:02:40 +0200
steve donovan <steve.j.donovan@gmail.com> wrote:

> On Tue, Jan 26, 2010 at 2:58 PM, spir <denis.spir@free.fr> wrote:
> > -- common other choice
> > MAX = ...
> > if n < MAX+1
> 
> But why do an extra operation? This alone would make the first one
> better (it expresses the condition more clearly)

Well, this form avoids comparing for equality in addition to inequality. (But I have no idea how much more costly <= is compared to <.)
I fully agree with "it expresses the condition more clearly". This is the relevant reason for me to choose "if n <= MAX".

> steve d.
> 

Denis
________________________________

la vita e estrany

http://spir.wikidot.com/