Unexpected token: position?

Hey Guys,
Im new and am confused why im getting this message in unity “Unexpected token: position”. Any help is appreciated! Thank you~

#pragma strict

var nextLevel : boolean;
     
  function Update()
  {
      nextLevel = true;
      for each(Collider in Physics.OverlapSphere(position: Vector3, radius: float))
      {
         if(co.gameObject.tag == "Enemy")
         {
            nextLevel = false;
         }
      }
         
      if(nextLevel)
      {
         Application.LoadLevel(levelIndex : int);
      }
  }

Your logic looks okay, but your syntax is kinda messed up. Here is something that compiles:

#pragma strict
 
 var nextLevel : boolean;
 var radius = 10.0;
 var levelIndex = 2;
      
function Update()
{
	nextLevel = true;
	for (var co : Collider in Physics.OverlapSphere(transform.position, radius))
	{
		if (co.gameObject.tag == "Enemy")
		{
			nextLevel = false;
		}
	}
	  
	if(nextLevel)
	{
		Application.LoadLevel(levelIndex);
	}
}

An alternate way of doing this would be to get a list of all the game object with the tag ‘Enemy’ using GameObject.FindGameObjectsWithTag(), and then to go through them and check their distance to the player. Or if the user must kill all the enemy objects, you can just do:

 if (GameObject.FindWithTag("Enemy") == null) {
     Application.LoadLevel(someLevel);
 }

In the following line, you are calling the function OverlapSphere, so you just need to pass some variables, not specify what types the variables will be.

for each(Collider in Physics.OverlapSphere(position: Vector3, radius: float))

Instead, try something like:

var pos = Vector3.up;
var radius = 3;

for each(Collider in Physics.OverlapSphere(pos, radius))