c# Raycastall, how to make it so it finds tags?

Im new to unity, what im trying to do is create a raycast which finds all objects taged enemy, which are in front of my player, and if they are in that area when i press the F key it takes some health of each of them, could someone please help me? heres my code:

using UnityEngine;
using System.Collections;

public class meleeAttack : MonoBehaviour {
public GameObject target;
public float attackTimer;
public float coolDown;

private RaycastHit hit;


// Use this for initialization
void Start () {
    attackTimer = 0;
    coolDown = 0.5f;
    
}

// Update is called once per frame
void Update () {


    if(attackTimer > 0)
        attackTimer -= Time.deltaTime;

    if(attackTimer < 0)
        attackTimer = 0;

    if (Input.GetKeyUp(KeyCode.F)) {
        if(attackTimer == 0)
        Attack();
        attackTimer = coolDown;
    }
}

private void Attack() {
    float distance = Vector3.Distance(target.transform.position, transform.position);
   
    Vector3 dir = (target.transform.position - transform.position).normalized;
    
    float direction = Vector3.Dot(dir, transform.forward);

    Debug.Log(direction);
    if (distance < 3 && direction > 0.5) {
        enemyhealth eh = (enemyhealth)target.GetComponent("enemyhealth");
        eh.AddjustCurrentHealth(-10);
    }
}

}

using UnityEngine;
using System.Collections;

public class enemyhealth : MonoBehaviour {

public int maxHealth = 100;
public int currentHealth = 100;

public float healthBarLength;
// Use this for initialization
void Start () {
    healthBarLength = Screen.width / 2;
}

// Update is called once per frame
void Update () {
    AddjustCurrentHealth(0);
}

void OnGUI() {
    GUI.Box(new Rect(10, 40, healthBarLength, 20), currentHealth + "/" + maxHealth);
}

public void AddjustCurrentHealth(int adj){
    currentHealth += adj;
    if (currentHealth < 0)
        currentHealth = 0;

    if (currentHealth > maxHealth)
        currentHealth = maxHealth;

    if (maxHealth < 1)
        maxHealth = 1;

    healthBarLength = (Screen.width / 2) * (currentHealth / (float)maxHealth);
}

}

You’ve got a raycastHit variable, but You’re never using raycast at all in your script. I won’t do the whole script over but I’ll show you how to use raycastall to get the tags of all objects directly in front of you, and how to tell how many there are. Attach this C# script named EXAMPLE to the main camera. Line some things up directly in front of the main camera’s path. Press F key to get tags of all the objects in front of the camera. Press L key to get the number of objects.

using UnityEngine;
using System.Collections;

public class EXAMPLE : MonoBehaviour 
{
	RaycastHit[] hits;
	float range = 100.0f;
	
	void Update()
	{
		hits = Physics.RaycastAll(transform.position, transform.forward, range);
		
		//Check how many hits by pressing L key.
		if(Input.GetKeyDown (KeyCode.L))
				print (hits.Length);
		
		foreach(RaycastHit hit in hits)
		{
			//Print the tag of each hit object by pressing F key.
		   if(Input.GetKeyDown (KeyCode.F))
				print (hit.collider.tag);
		}
	}
}