Why my method doesnt see variables | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Why my method doesnt see variables

Hello Sololearn,pls help me to fix my code my method myFunc() doesnt see variables Pls look at this code https://code.sololearn.com/cUCLmU2OjVPf/?ref=app

28th Aug 2018, 3:49 PM
Fury
3 Antworten
+ 1
You need to pass your variables as arguments to the function. Then you will be able to use them.
28th Aug 2018, 6:08 PM
Steppenwolf
Steppenwolf - avatar
+ 1
Normally, I've had TextBox and EditText as class variables, which you can then populate in your methods. This allows all methods to have access to them. You could pass them as arguments too, but at the moment they are all declared in the on#click methods, so they will be limited to that scope unless you pass as a parameter
28th Aug 2018, 8:01 PM
Dan Walker
Dan Walker - avatar
0
Thanks for everybody,I have fixed my code.Thanks
29th Aug 2018, 3:35 AM
Fury