Not all paths return a value

I am making a function that detects if a collision has occurred, found if somewhere and don’t understand it much, it appears to return a value, but for some reason the unity editor provides me with a “Not all code paths return a value” error

my code is included below, if anyone can aid me in fixing it or even cleaning it up, i would be most grateful

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using Random = UnityEngine.Random;

public class Mspawn : MonoBehaviour {
public Button button;
public BoardManager boardManger;
public LayerMask BlockingLayer;

private float x;
private float y;
void OnEnable(){
	
	if (Input.GetMouseButtonDown(0)) {
		button.onClick.AddListener (SpawnUnit);
	}
	
	
}

void Awake(){
	boardManger = GetComponent<BoardManager> ();
	
}
void SpawnUnit()
{
	
	x = randomSpawnPosition ().x;
	y = randomSpawnPosition ().y;
	//checkposition ();
	for (int i = 0; i < boardManger.PlayerUnits.Length; i++) 
	{
		if (boardManger.PlayerUnits*.CompareTag("PlayerSoldierMarksman"))*
  •   	{*
    
  •   		if (checkposition(randomSpawnPosition()))*
    
  •   		{*
    
  •   		}*
    

_ Instantiate (boardManger.PlayerUnits*, new Vector3 (x,y,0f), Quaternion.identity);_
_
}_
_
}_
_
}_
_
//This is the problem function, this is where the error occurs*_
* public bool checkposition(Vector3 SpawnedPosition)*
* {*
* GameObject[] AllActive = GameObject.FindGameObjectsWithTag (“PlayerHQ”);*
* foreach (GameObject active in AllActive)*
* {*
* if (active.transform.position == SpawnedPosition)*
* {*
* return false;*
* }*
* else {return true;}*
* }*
* }*
* Vector3 randomSpawnPosition()*
* {*
* float x = Random.Range(0,2);*
* float y = Random.Range(0,2);*
* Vector3 Position = new Vector3 (x, y,0f);*
* return Position;*

* }*
}

Didnt read sorry. Based on the title you must make sure that in a function which expects a return value, if you have if else statements or any other kind of branching you must make sure to include a return statement at the end of each branch.

OK I had a little look.

What about the case in which there are 0 GameObjects in AllActive? Both return statements will be skipped.