Reputation:
I was writing code on this chromebook, which I wanted to code in the Processing enviroment, so I searched online for a online Processing, and I got open processing. I get the Unexpected Identifier error on line 1.
Bird bird;
function setup() {
createCanvas(600, 1000);
background(0);
bird = new Bird();
}
function draw() {
bird.show();
}
Upvotes: 0
Views: 135
Reputation: 4219
There are (at least) two Processing environments: Processing (which is based on java) and p5.js (which is based on javascript). They are not interchangeable so you need to make sure you know which you're using, and that any examples you're reading are for the corresponding version.
Since you mentioned OpenProcessing and your functions are defined with the function
keyword, I assume you're using p5.js. In that case, the problem is that javascript is not a typed language, so you don't put the type of the variable before it. Changing
Bird bird;
to
var bird;
removes the Unexpected Identifier error, but you'll still have an error on line 7 where you try to do
bird = new Bird();
without defining what a Bird
is. Hope that helps! Let me know if you have any other problems.
Upvotes: 1