Embarrasingly basic issue with if statement checking if float is equal to 1

I’m sure this script is inefficient and a sore sight for the more advanced scripters, but if you could bare the pain of looking at it long enough to tell me the problem that’d be swell.

   function Stack()//--------------------------------------
    {
    
    if(StackNum = 1){
    	StackedGenX01 = GenX;
    	StackedGenY01 = GenY;}
    if(StackNum = 2){
    	StackedGenX02 = GenX;
    	StackedGenY02 = GenY;}
    if(StackNum = 3){
    	StackedGenX03 = GenX;
    	StackedGenY03 = GenY;}
    if(StackNum = 4){
    	StackedGenX04 = GenX;
    	StackedGenY04 = GenY;}
    
    }

I get the errors:

Assets/A A A/ObjectGenManager.js(158,13): BCE0044: expecting ), found ‘=’.

Assets/A A A/ObjectGenManager.js(158,15): BCE0043: Unexpected token: 1.

Assets/A A A/ObjectGenManager.js(159,23): BCE0044: expecting :, found ‘=’.

They refer to the first and second line of the if statement.

Is the issue actually the script that I’ve posted or is Unity lying to me and the issue somewhere else entirely?

Thanks in advance for any help.

You really shouldn’t compare floats this way, but the comparison operator is two equal signs:

if (StackNum == 1) {
}