New to programming and console tells me " 'enemy' is a variable but is used like a type" help pls

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerCombat : MonoBehaviour
{

public Animator animator;

public Transform attackPoint;
public float attackRange = 0.5f;
public LayerMask enemyLayers;

public int attackDamage = 40;

// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Mouse0))
{
Attack();
}
}

void Attack()
{
//Play an attack animation
animator.SetTrigger(“Attack”);
//Detect enemies in range of attack
Collider2D[ ] hitEnemies = Physics2D.OverlapCircleAll(attackPoint.position, attackRange, enemyLayers);
//Damage them
foreach(Collider2D enemy in hitEnemies)
{
enemy.GetComponent().TakeDamage(attackDamage);
}
}

void OnDrawGizmosSelected()
{
if (attackPoint == null)
return;

Gizmos.DrawWireSphere(attackPoint.position, attackRange);
}
}

Is your class enemy or Enemy? Remember, caps matter. If it is enemy, then you shouldn’t use enemy as part of your foreach loop as it’s confusing it.