Code: Select all
convertNull(global_variable, newList("default", "values"));
Code: Select all
if (global_variable == null) { global_variable = false; }
Best way to initialize global variables?
Moderator: Martin
Best way to initialize global variables?
There are several ways to set Variables and i want your opinion which one's the best. If you know of any other way i forgot, please tell me and i add it :^)
Unofficial AutoMagic Telegram Group: https://t.me/automagicforandroid
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.
Re: Best way to initialize global variables?
I just go to the global variable and create the GloVar there Just kidding
I use also the same, with slight different style
For single line script after if() with no else, we can remove the curly braces.
Be careful thought, sometimes empty GloVar doesn't always mean it is null. Sometimes it is '' (two single quote). If it is that case, convertNull() will fail, global_variable == null also give false. It should be global_variable == '' which gives true.
I use also the same, with slight different style
Code: Select all
if(global_variable == null)
global_variable = false;
Be careful thought, sometimes empty GloVar doesn't always mean it is null. Sometimes it is '' (two single quote). If it is that case, convertNull() will fail, global_variable == null also give false. It should be global_variable == '' which gives true.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.