Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Just for comparison:

  b, a = a, b 
is actually valid code in Lua (and works as expected).

Grabbing only one value looks like this

  _, y = returnsTwoValues() -- grab only the second 

  y = returnsTwoValues() -- grab only the first


This works similarly in Ruby:

    a,_ = two_values()
    _,b = two_values()




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: