I have function called firstRun()
, inside of it I have two defined booleans filesDeleted
and dirsDeleted
.
Also inside in function
Change your
bool filesDeleted;
bool dirsDeleted;
to
bool filesDeleted = false;
bool dirsDeleted = false;
These are local variables and they must be assinged before use them.
From 5.1.7 Local variables
A local variable is not automatically initialized and thus has no default value. For the purpose of definite assignment checking, a local variable is considered initially unassigned.
Unlike class member variables, local variables in methods do not have a default value, and must be definitely assigned before you try and read from them:
so you need to use
bool fileDeleted = false;
bool dirsDeleted = false;
instead of
bool filesDeleted;
bool dirsDeleted;