lua-users home
lua-l archive

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


> On Mar 13, 2017, at 1:35 AM, Sean Conner <sean@conman.org> wrote:
> 
>  I only use multiple assignments in one line for two cases:
> 
> 	permuting values (and then, it's usually only a swap of two values)
> 	when a function returns more than one value
> 
> For everything else, I tend to use one variable per line.  I tend to like
> vertical code layouts (it comes from years of assembly language
> programming).
> 

Interesting, because I like multiple assignment to get just the opposite effect (also after many years of assembly coding). Given that the more of my code I can see on the screen at once, the more I like it, I tend to try to use a more horizontal style. However, I try to avoid piling up too many assignments (3-4 max), and only when the RHS expressions are simple.

Also,
its
often
easier
to
read
code
horizontally.

Another case is when a few local control variables are being setup for some following block of code. I like that they are grouped together to essentially say “setup state for the following code”.

—Tim