Spawning won't work

I am writing a script to spawn a mass of cubes when I press X. When I try to run it unity say unexpected token.

// JavaScript




function Start ()
if(Input.GetButtonDown("X"))		

 {
    for (var y = .5; y < 10; y++) {
        for (var x = 0; x < 10; x++) {
        	 for (var z = 0; z < 10; z++) {
            
            var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
           
             cube.AddComponent(Rigidbody);
            cube.rigidbody.mass = 10;
            cube.transform.position = Vector3 (x, y, z);
     print ("made");
 
                       }
    }
	
}
	
}

You don’t want that in Start, you won’t be able to push the desired buttonDown before Start is done. Replace “X” with KeyCode.X