How to make an object transparent

How to i change an object opaciity? im trying to make a wall that changes its opacity based on how much hp it has left. my code is as follows:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Break : MonoBehaviour
{
    public GameObject wall; 
    public float hp = 10f;
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if (hp == 0)
        {
            wall.gameObject.SetActive(false);
        }
    }
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "break")
        {
            hp--;
        }
    }
}

i belive the update block is what needs to change, but im not sure.

Similar question

im not entirely sure what im looking at, but i did try the code and tried to tweak it to no avail. any ideas?

    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "break")
        {
            hp--;
			GetComponent<Renderer>().material.color=new Color(1,1,1,hp/10);
        }
    }

thank you so much!