How to simplify my code?

Hi everyone. My tutor said that my code can be simplified. But idk how
It looks smth like that :

public List<KeyCodes> Inputs;
public AudioSource audioSource;
public AudioClip[] audioClip = new AudioClip[5];

void Update()
{
KeyInput();
}
void KeyInput()
{
if(Input.GetKeyDown(Inputs[0]))
{
audioSource.PlayOneShot(audioclip[0])
}
... and so on and so forth.
}

He said that holding 2 arrays in 1 class its bad idea…or smth like that… If i not mistaking he said that i need to create different classes for inputs,audioclip,but im not sure,cause i dont remember(

This is not really a good description what your class actually does. I would assume that you want to select a keycode for each audio clip? In that case it’s a lot easier to simply create a serializable class that groups one audio clip and one keycode into one unit. That way you would have a single array or list of that class. The processing can be done in a loop.

[System.Serializable]
public class AudioClipKey
{
    public AudioClip clip;
    public KeyCode key;
}

public List<AudioClipKey> items;

// [ ... ]

void KeyInput()
{
    foreach(var item in items)
    {
        if(Input.GetKeyDown(item.key))
        {
            audioSource.PlayOneShot(item.clip);
        }
    }
}

Hello, it would help if you could explain to us exactly what your code is for so we better help you chose the most optimized solution. If you could do this I might be able to help.