Break loop when colliding with object

I have a problem with breaking the loop, when it hits “Wall” or “Box” object, but I am not sure, how I should check it. I know the Collision method and to destroy objects with it, but I need to use it in this switch statement.

void ExpolsionController(Vector3 position)
    {
        float x = position.x;
        float y = position.y;
        float z = position.z;
        for (int i = 0; i < 4; i++)
        {
        outer:
            for (int j = 0; j < bombExpoltionArea; j++)
            {

                switch (i)
                {
                    case (0):
                        Instantiate(explosion, new Vector3(x + j, y, z), Quaternion.identity);
                        if (Collision.Equals("Wall", "Box"))
                            goto outer;
                        break;
                    case (1):
                        Instantiate(explosion, new Vector3(x - j, y, z), Quaternion.identity);
                        break;
                    case (2):
                        Instantiate(explosion, new Vector3(x, y, z + j), Quaternion.identity);
                        break;
                    case (3):
                        Instantiate(explosion, new Vector3(x, y, z - j), Quaternion.identity);
                        break;
                }
            }

make a bool in OnCollisionEnter()?