Help rewriting sketch: keypad-lock

default:
      attempt[z]=key;
      z++;

What if one enters more than 6 numbers without pressing * or # ?