How to declare a constant in Processing editor & p5.js? (reported issue)

Thanls Kevin. Actually, the following example works fine in browser and is editable on other editors like Alpha web editor, Notepad++ and Netbeans. All of them do not claims for a syntax error.

const PASSWORD_MIN_LENGTH = 4;

function setup() {
  createCanvas(400, 400);
	
	alert(PASSWORD_MIN_LENGTH);
	
}

function draw() {
  background(220);
}

But what I’ve just observed is that if I create a new p5.js sketch into Processing IDE and paste the above code, everything works fine in browser and editor. So I must investigate what’s the difference between my project code and my test code. It’s late but I’m gonna do it as soon as possible. In the same time, I’m gonna try to make a MCVE, good idea!

1 Like