Hadi KAR
Hadi KAR

Reputation: 464

Why processing keeps saying "SyntaxError : Expected ; but found size" but it run just ok in p5.js online editor?

The processing console keeps saying Syntax Error: Expected ; but found size. I have copy pasted my code to p5.js online editor and it ran just fine.

var ur;
var x;

function setup() {
  createCanvas(400,400);
  x=width;
  ur = getURL();
}

function draw() {
  background(100);
  fill(0);
  noStroke();
  let size = 9;
  textSize(size);
  text(ur,x,height/2);
  x--;
  if(x<-1*(ur.length)*size) x = width;
}

Upvotes: 1

Views: 321

Answers (1)

rednoyz
rednoyz

Reputation: 1327

The problem is not with let, but with the use of 'size' as a variable name, which is (or was, see this ticket for more info) a reserved word in p5.js. If you change 'size' to 'theSize', for example, things should work fine.

Upvotes: 1

Related Questions