lua-users home
lua-l archive

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

On Thu, Jun 5, 2014 at 12:10 AM, Jay Carlson <> wrote:
> In fake Lua syntax, the Ruby approach would look like:
> sortedStrings = stringArray:sorted() doing (a, b)
>     return a:uppercaseString() < b:uppercaseString()
> end

Boo (the second-greatest programming language from Brazil) does it like this:

result = [1, 2, 3].Find() do (item as int):
      return item > 1

The rule is that if the last argument of a function is a function,
then it can be defined afterwards with a do-block.

(Boo looks like Python, but underneath it's a statically-typed
language with local type inference, which is a popular choice these