+ 2
[HELP] Can I use a parameter of a user defined function as a variable in the main function?
No description. That is what it is.
6 Answers
+ 5
no user defined functions also cannot act as variables
+ 1
No, you can't. A method can't act like a variable.
+ 1
No, if you pass a parameter, you need to send the value of that parameter through another variable or value. But the parameter in a function should be used inside the function.
0
Seems like we cant give user input to it. check a code
https://code.sololearn.com/c0IMJwXfJnfR/?ref=app
0
I'm not taking about the whole method, what about the parameters it has?
0
example you gave illustrated scope of x. You seem to think x of the function is the same x in the program. It is not unless you are using a global var x.
The only ways to get an output from your function call
1. Set default value for parameter
2. Pass in x (e.g. func(x))