Evaluating key codes with switch statement vs an array

To evaluate key codes the switch statement can be used.  Also, an Array instance can be utilized to specify each operations.

キーコードに応じた処理は、switchステートメントを使うほか、配列を用いる手法も考えられます。