Can we initialise a variable inside the body of the while loop?

If yes, can it be used after the loop is completed?

30th Jul 2016, 6:18 AM
Rachit Singhvi
Rachit Singhvi - avatar
2 Réponses
if condition does not use the variable it is fine else there will be a dump..
1st Aug 2016, 1:59 PM
RB Vijey Shankar
RB Vijey Shankar - avatar
you need to declare the data type of the variable before the loop. then inside the loop, you can initialize it. yes it can be used after the loop is completed.
3rd Aug 2016, 10:58 AM
Arundhati - avatar