Which one to use for, while or something else?

Hello, I need to cycle through a array of “keys” when I try to pick up or drop a key and add or remove a key from the correct spot but I can’t seem to get this to work.
Code:

public void AddKey(KeyObject key)
{
    for (int i = 0; i < keys.Length; i++)
    {
        if (keys *!= null) break;*

if (keys == key) return;
if (keys == null)
{
keys = key;
return;
}
}
}
public void DropKey(KeyObject key)
{
for (int i = 0; i < keys.Length; i++)
{
if (keys != key) break;
if (keys == key)
{
keys = null;
return;
}
}
}

Try this:

public void AddKey(KeyObject key)
 {
     for (int i = 0; i < keys.Length; i++)
     {
         if (keys *== key) return;*

if (keys == null)
{
keys = key;
return;
}
}
}
public void DropKey(KeyObject key)
{
for (int i = 0; i < keys.Length; i++)
{
if (keys == key)
{
keys = null;
return;
}
}
}