scripting problem with if statements

i have this script so i can switch between weapons, a sword and a ninja star.

function Update()
{
    var sword = Transform;
    var star = Tranform;

    sword.active = true;
    star.active  = false;

    if(sword.active = true)
    {
    }
    if(sword.active = true)
    {
    }
}

When i save this i get 5 errors: Assets/my scripts/walker.js(25,21): BCE0044: expecting ), found '='.

Assets/my scripts/walker.js(25,23): BCE0043: Unexpected token: true.

Assets/my scripts/walker.js(28,10): UCE0001: ';' expected. Insert a semicolon at the end.

Assets/my scripts/walker.js(29,24): BCE0044: expecting ), found '='.

Assets/my scripts/walker.js(29,26): BCE0043: Unexpected token: true.

Assets/my scripts/walker.js(32,10): UCE0001: ';' expected. Insert a semicolon at the end.

Can you tell me why i this is happening?

= is an assignment operation
== is a comparison operation

should be

if(sword.active == true)

But the "== true" part is redundant when checking Boolean operation like that. You can just do:

if(sword.active)

will work fine, or if you want to check if false

if(!sword.active)