Whats wrong with this script?

Hi, I’m new to Unity and C# coding, I’m trying toenter code here make this simple script.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class myLight : MonoBehaviour
{

    public int int1;
    public int int2;
    public Light Lamp;

    void Update()                   //If Sum of the 2 integers is 10, then the lamp will be turned on
    {
        int final = TenSum(int1, int2);
        if(final = int (10)) {
            Lamp.enabled = true;
        } else {
            Lamp.enabled = false;
        }


    }

    int TenSum(int int1, int int2)  //Return the sum of 2 integers together
    {
        int Return = int1 + int2;
        return Return;
    }
}

So apparently on the line “if(final = int (10)) {”, Visual Studio says that it is an invalid expression term.
What went wrong?

A single “=” is the assignment operator which does set the left side of the operator to the value on the right side.

Next thing is the way you use “int” inside the if expression makes no sense. “int” is a type which don’t belong here at all

You want to use the equal-comparison operator “==” instead.

“Finally” you should be careful with the variable names. “final” is a reserved key word. Some keywords can be reused as variable names but it’s best to avoid this situation completely. Since you store the sum in that variable you should name it either “sum” or maybe “finalSum”:

int finalSum = TenSum(int1, int2);
if (finalSum == 10)