Compliler Error... Unexpected Char '''

In order to customize the effect of more then one button being held down at the same time, I have written a function called CheckButtons() that checks each frame to see which buttons are being held down, and then alters a variable named buttonsDown (string) which then can be accessed by other aspects of the script instead of the traditional `Input.GetButton...`. Here is the function:

function CheckButtons()
    {
        if(Input.GetButton("W"))
        {
            buttonsDown = buttonsDown + "w";
        }
        if(Input.GetButton("A"))
        {
            buttonsDown = buttonsDown + "a";
        }
        if(Input.GetButton("S"))
        {
            buttonsDown = buttonsDown + "s";
        }
        if(Input.GetButton("D"))
        {
            buttonsDown = buttonsDown + "d";
        }

    }

It is then accessed by the movement part of the script:

 if(buttonsDown = 'w')
{
    transform.position += transform.forward * moveSpeed * Time.deltaTime;
}

(Just one of many reactions to buttonsDown's current value.)

However, the pesky debugging console tells me that there is an unexpected character ''' in this line: `if(buttonsDown = 'w'`. I cannot seem to tell what error I made! I'm not that good with unity... so please be gentle if it's a really obvious mistake. Thanks!

Not sure if its causing your error, but "buttonsDown = 'w'" (note the single equals sign) is an assignment operation and not equivalency. For equivalency you want to have "if(buttonsDowns == 'w')" using the double equals sign.