Hello.
An error occurred during processing coding. I don’t know what the problem is.
In points (a,b), a wants to get a +d(random)
The error is the same as ’ expecting }, found ‘else’ '.
If you’re good at processing, please give me some advice.
void setup() {
int a = 0;
int b = 10;
int d = random(8, 16, 20);
size(400, 400);
}
void draw() {
background(190, 255, 255);
strokeWeight(30);
stroke(0, 0, 0, 50);
point(a, b);
for (i = a; i <= width; ++i) {
if (i < 400);
e = true;
} else {
e = false;
}
if (e == true) {
point(i, b);
}
if (e == false) {
point(i, j);
}
}
Hello,
I don’t know if it s helpfull but if you don’t find your ifferent mistaskes by your own… here a code that do not resolve the random problem.
Have a good day ^^
int a = 0;
int b = 10;
int i=1;
int j;
boolean e;
void setup() {
int d = random(16, 20);
size(400, 400);
}
void draw() {
background(190, 255, 255);
strokeWeight(30);
stroke(0, 0, 0, 50);
point(a, b);
for (i = a; i <= width; ++i) {
if (i < 400){ e = true; } else {e = false;};
if (e == true) { point(i, b);};
if (e == false) { point(i, j);}
}
}
You declared variables a and b in setup and tried to use them in
draw().
That doesn’t work.
declare them before setup() so they are known everywhere. This is called Variable Scope.
Remark
You had this:
if (i < 400);
The semicolon ENDS the if-clause. Bad.
Remark
Also you had a closing } bracket, but no opening bracket, so processing assumed you were closing the for loop
Remark
You had point(i, j); but there is no j.
Remark
You if was for <400 but 400 is also your maximum screen, so e was always true.
Chrisir
Full code
int a = 0;
int b = 10;
float d = random(8, 20);
boolean e;
void setup() {
size(400, 400);
}
void draw() {
background(190, 255, 255);
strokeWeight(30);
stroke(0, 0, 0, 50);
point(a, b);
for (int i = a; i <= width; i++) {
if (i < 200) {
e = true;
} else {
e = false;
}
if (e == true) {
point(i, b);
}
if (e == false) {
point(i, 20);
}
}
}