Assets/scripting_basics2.js(106,21): BCE0067: There is already a local variable with the name 'doesFightHappen'. error, I'm just learning to use javascript, and just playing around, and this is the script. . .
function Update ()
{
var skylerHappy : boolean = true;
var meganHappy = false;
var skylerCigarretes = 4;
var meganShoesOn = true;
var dishesInSink = true;
var poopOnFloor = true;
var doesFightHappen : boolean = false;
if (skylerHappy == true && skylerCigarretes >= 2)
{
var doesFightHappen = false;
print (doesFightHappen);
}
else
{
var doesFightHappen = true;
print (doesFightHappen);
}
}
K, so it may be sloppy, and I'm sure I messed it up somewhere stupid, but why wouldn't I be able to change that variable like that to true if I was not happy, and did not have smokes left?!?!? I stared at it for 10 minutes, can't find the error, and the error doesn't bother me so much as needing to know why its wrong so I don't do it when I'm actually coding something serious.
↧