Matrix Keypad - Optimisation

Must be defined as 'a' 'b' as then they are of the type char, just a would be a variable name.

The values allowed in a switch statement behind the case include byte, char, int, long and unsigned versions of it. Furthermore the enum type can be used.

// sample code to show the usage of enum type

enum Days { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday };

void setup()
{

  Days thisDay = Sunday;
  
  switch ( thisDay )
  {
    case Sunday:
    break;
    case Monday:
    break;
    case Tuesday:
    break;
  }
}

void loop()
{
}

[edit]enums are ideal for state machines[/edit]