var yPos = 0.0;
function setup() { // setup() runs once
createCanvas(100, 100);
frameRate(30);
}
function draw() { // draw() loops forever, until stopped
background(204);
yPos = yPos - 1.0;
if (yPos < 0) {
yPos = height;
}
line(0, yPos, width, yPos);
}
They are created like functions, and thus, there's no special Class syntax. You can read more about this on Mozilla MDN