- Home /
Question by
BjarkeDuDe · Oct 14, 2012 at 03:41 PM ·
javascripterrorbug
syntax errors
Again these errors seem to have no purpose! :( http://www.youtube.com/watch?v=UulhKg96fv8&feature=youtu.be
var dubstep : AudioClip;
var tripEffects : //not assignet yet.
function acidTrip()
{
audio.clip = dubstep;
audio.Play();
tripEffects.enabled = true;
}
function Update ()
{
if(Input.GetKeyUp("p"))
{
acidTrip();
}
}
Comment
Of course they have a purpose. Specifically, they are telling you what you're doing wrong.
Best Answer
Answer by aldonaletto · Oct 14, 2012 at 03:55 PM
This line is causing the error:
var tripEffects : //not assignet yet.
It ends with a : instead of a ; and the compiler thinks that the line continues in the function declaration below it. If you know tripEffects type, define it. If not, let it untyped for now:
var tripEffects;
or simply comment it out while you decide what tripEffects will be:
//var tripEffects
Thank you very much! You have enriched my understanding of javascript. lol xD