Input - is it OK to use SWITCH?

is it ok to use SWITCH-CASE like this or should I use rather if-else?
And here goes the most important question: which is more resource efficient?
Meaning which uses up less memory?
My script works withou the Input.anyKeyDown condition, but it doesn’t work with it…why is that?

void KeyboardControl()
{
	if(Input.GetKeyDown (KeyCode.R))
	{
		for(int i = 0; i<playerClonesHolder.transform.childCount; i++)
		{
			playerClonesHolder.transform.GetChild(i).FindChild ("dmgCube").GetComponent<DmgCube_scr>().ChargeStaff();
			
		}
	}
	if(Input.anyKeyDown)
	{
		switch(Input.inputString)
		{
		case "1":
			Debug.Log ("1 pressed");
			break;
		case "2":
			Debug.Log ("2 pressed");
			break;
		case "3":
			Debug.Log ("3 pressed");
			break;
		case "4":
			Debug.Log ("4 pressed");
			break;
		case "5":
			Debug.Log ("5 pressed");
			break;
		case "6":
			Debug.Log ("6 pressed");
			break;
		case "7":
			Debug.Log ("7 pressed");
			break;
		case "8":
			Debug.Log ("8 pressed");
			break;
		case "9":
			Debug.Log ("9 pressed");
			break;
		case "0":
			Debug.Log ("0 pressed");
			break;
		default:
			Debug.Log ("this is not a valid key");
			break;
		}

	}
}

Switch uses numerous optimization techniques like jump padding and selectiion by hashing. If you are using numbers(or enums or explicit numeric enums) for many possible outcomes it is much faster due to how proccessor conveyor works. If you switch by object hashing takes place and this becomes consideration factor requiring benchmarking. Regarding code in the ecxample: switch is the best way by performance and maintainability.

Additionali, I recommend to switch to unity keys enum for max performance gain

I’ve got it:

for(int i = 0; i<10; i++)
{
    if(Input.inputString == i.ToString ())
    {
        Debug.Log (i + " pressed");
    }
}