Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple locals on one line?

Tags:

syntax

lua

Consider the following Lua code:

local var1, var2; 

Is var2 a local variable here? Or is only var1 a local?

like image 331
SirRatty Avatar asked Jul 03 '10 01:07

SirRatty


People also ask

Can you define multiple variables in one line?

Do not declare more than one variable per declaration. Every declaration should be for a single variable, on its own line, with an explanatory comment about the role of the variable. Declaring multiple variables in a single declaration can cause confusion regarding the types of the variables and their initial values.

Can you declare multiple variables in one line in C?

If your variables are the same type, you can define multiple variables in one declaration statement. For example: int age, reach; In this example, two variables called age and reach would be defined as integers.

How do I declare multiple variables in bash script?

Another way to assign multiple variables using a command's output is to assign the command output fields to an array. In the example, we used the Bash built-in readarray command to read the date command's output. The default delimiter used by the readarray command is a newline character.

How do I assign multiple values to one variable in r?

You can assign the same value to multiple variables by using = consecutively. This is useful, for example, when initializing multiple variables to the same value. It is also possible to assign another value into one after assigning the same value.


1 Answers

Both are local.

like image 84
lhf Avatar answered Sep 19 '22 19:09

lhf