Re: [Vala] Suggestion: first {} and last {} operators in iteration-loops





2007/9/7, Jürg Billeter <j bitron ch>:
On Fri, 2007-09-07 at 11:51 +0200, Raphael Bosshard wrote:

Thanks for your suggestion. Special treatment for the first and/or the
last element is certainly used quite often, however I'm not sure that
first{} and last{} would fit in well enough into the syntax. I also
don't know of other programming languages providing something similar,
so it might actually be more confusing than helping like that. Maybe
there is another way to assist when you need to treat the first and/or
the last element in an iteration specially.


I think it would be better to provide negative index support for arrays (array[-1]) and use a for loop that excludes the first and last item just in case you need special treatment for first and last rather than extending the language in such a strange way.


--
Un saludo,
Alberto Ruiz

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