I am having an issue with vector 3 angles when multiple game objects are involved

This reference from unity works perfectly; however, it only works when trying to detect the angle of a single game object. Is there some way to make this into an array, so that it detects whether or not any game objects are within a certain degrees? As of now, it only detects the angle of a single game object and ignores any others. C# only please, THANKS!!!

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Transform target;
    void Update() {
        Vector3 targetDir = target.position - transform.position;
        Vector3 forward = transform.forward;
        float angle = Vector3.Angle(targetDir, forward);
        if (angle < 5.0F)
            print("close");
        
    }
}

You could use a for loop to achieve this:

 using UnityEngine;
 using System.Collections;
 
 public class ExampleClass : MonoBehaviour {
public Transform[] target;//add all objects here
	private int i;//Made it global so when I can make it 0 easily and start for loop again.
	float angle;

	void Update() 
	{
		for (i = 0; i < target.Length; i++)//go from through whole array.
		{
			Vector3 targetDir = target *.position - transform.position;*
  •  	Vector3 forward = transform.forward;*
    
  •  	angle = Vector3.Angle (targetDir, forward);*
    
  •  	if (angle < 5.0F)* 
    
  •  	{*
    

_ print (“Close” + target .name);_
* }*
* }*

* if(i == target.Length - 1)//This happens after the for loop has gone through all of them.*
* i = 0;//rest “i” back to 0 so we can start the for loop again.*
* }*
}