4 ms·
Golang does multiple returns. Can also accomplish the same in PHP by returning arrays and using list() syntax as the lvalue.
by jstewartmobile 7y ago
Golang does multiple returns.
Can also accomplish the same in PHP by returning arrays and using list() syntax as the lvalue.
- Hamuko 7y agoHow do Lua and Go differ from returning a tuple in Python?
- jstewartmobile 7y ago# python, fn() returns tuple (college, student, type_ofcollege) = fn() # php, fn() returns array list(college, student, type_ofcollege) = fn() # go, fn() returns multiple values college, student, type_ofcollege := fn() # lua, fn() returns multiple values college, student, type_ofcollege = fn()
- __warlord__ 7y agoFor Python, a tuple is not necessary when returning multiple values, you can use the same syntax as lua. Edit: I stand corrected, indeed, Python returns a tuple.