I am not sure if the logic behind this approach is easy to understand. The idea behind the variable is that it counts the number of correct inputs. So always when the input is correct it adds 1 to the variable but if you are wrong the variable is set back to 0. Only if your variable reach 3 (or 4 if you chose a 4 digit pin) the desired action such as opening the door will be triggered.
I am not sure if the logic behind this approach is easy to understand. The idea behind the variable is that it counts the number of correct inputs. So always when the input is correct it adds 1 to the variable but if you are wrong the variable is set back to 0. Only if your variable reach 3 (or 4 if you chose a 4 digit pin) the desired action such as opening the door will be triggered.
YES!!!