dayo92/SoltMachine

Declare variable within loop

Closed this issue · 0 comments

Instead of having this flag before your loop set to false

bool matchFound = false;
while (true)

and have to reset it after every iteration
matchFound = false;

you could just place it in the beginning within your loop: this way it will be set to false for every iteration and you do not have to reset it afterwards.

The way you have implemented it is very error prone because you when modifying your code you need to be aware in what cases you have to reset that variable and must not forget