Ethan Allen :
I get variable shadowing warnings in the following code for it
, because it's nested. How do I fix this warning properly?
Network.callServer(Constants.url + "/get_call_one.php", dataToSend) {
if (it["result"].toString() == "PASS")
{
Network.callServer(Constants.url + "/get_call_two.php", dataToSend) {
if (it["result"].toString() == "PASS")
{
// do stuff
}
}
}
}
Simson :
The code have some implicit hidden declarations it -> ...
Network.callServer(Constants.url + "/get_call_one.php", dataToSend) { it->
if (it["result"].toString() == "PASS")
{
Network.callServer(Constants.url + "/get_call_two.php", dataToSend) { it->
if (it["result"].toString() == "PASS")
{
// do stuff
}
}
}
}
just rename one or both of them:
Network.callServer(Constants.url + "/get_call_one.php", dataToSend) { it1->
if (it1["result"].toString() == "PASS")
{
Network.callServer(Constants.url + "/get_call_two.php", dataToSend) { it2->
if (it2["result"].toString() == "PASS")
{
// do stuff
}
}
}
}