Quick question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Quick question

Can you use variables as parameters for your function?

27th Apr 2020, 6:42 AM
Hringo
 Hringo - avatar
1 Answer
0
You can use variable as ARGUMENT for the PARAMETERS of a function call ^^ A function need to first exists to be called (used/executed/ran), so you first declare the function definition with a name (usualy -- anonymous function could exists) and a SIGNATURE wich is the parenthesis with function PARAMETER names (the variable names used localy to -- inside -'- the function to access the ARGUMENTS -- values or references -- passed at the function call). Then, when you call the function, you can use variables (wich hold/contains values or references) as ARGUMENTS: under the hood, either the variable reference or the variable value will be passed to the function body by filling its local PARAMETERS variables (execution context) accordingly, depending on language and sometimes on context ;)
27th Apr 2020, 8:16 AM
visph
visph - avatar