Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Variable assignment

variables a, b, c and d all need to be set to 'foo'.

Is there a way to accomplish this in one swooping assignment? Like:

a, b, c, d = 'foo'

like image 494
keruilin Avatar asked Dec 03 '22 12:12

keruilin


1 Answers

Ref this

Best way to do it as follow as you need common value to all your variables

a= b= c = d = 'foo'

for different value you can do

a, b, c, d = 'foo1', 'foo2', 'foo3', 'foo4'
like image 55
Salil Avatar answered Dec 20 '22 15:12

Salil