lua-users home
lua-l archive

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


On Fri, Sep 10, 2010 at 5:31 PM, Alex Queiroz <asandroq@gmail.com> wrote:
> On Fri, Sep 10, 2010 at 6:28 PM, Duncan Cross <duncan.cross@gmail.com> wrote:
>> Or even 'x if b else y' - even shorter and does not require a new keyword.
> Please, let's avoid postfix operators a la Perl and Ruby.

The question of whether to postfix or not also comes up in list
comprehensions [1]:

  S = [2*x for x in range(101) if x**2 > 3]  # Python
  var s = [2*i for (i in 100) if (i*i>3)]; // JavaScript
  var s = for (i in [1..100][n | n*n > 3]) { 2*i } // JavaFX

[1] http://en.wikipedia.org/wiki/List_comprehension