タイトルにあるようにエラーが発生し続けますが、何があっても l の値が返されるようです。ここでの問題は何ですか?変更がない場合、 out l を処理するelseステートメントがあります。
public int validate(int zip, int i, out int l)
{
if ((zip < 10000) || (zip > 99999))
{
Console.WriteLine("Input not accepted. Zips are 6-digits long.");
error = true;
}
else {
listzip[i] = zip;
error = false; }
for (int g = 1; (g <= (i - 1)); g++)
{
if (listzip[i] == listzip[g])
{
Console.WriteLine("Repeated zip detected, please re-enter.");
if (!error) error = true;
} else error = false;
}
if (error)
{
l = i--; // forces a step back if an error was detected
}else l = i;
}