We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Having Trouble Resolving Error
Page Index Toggle Pages: 1
Having Trouble Resolving Error (Read 385 times)
Having Trouble Resolving Error
Sep 21st, 2006, 7:25am
 
I realize I'm probably doing something extremely stupid, but with as much searching as I've done, I still can't figure it out.  I keep getting the error "AssignmentOperator AssignmentExpression"

Here's the simple code

size(200,200);
stroke(255);
background(0);
int xi = 4;
int xj = 50;
int yi = 12;
int yj = 75;

yi = height - yi;
yj = height - yj;


int dx = xj - xi;
int dy = yj - yi;

int ey = 0;
for( xi ; xii == xj; xi++);
{
 point(xi, y);
 ey = ey + dy;
 if( ey >= dx) {
   y++;
   ey = ey - dx;
 }
}

It says the problem is with the for line, but I can't see why either the == or ++ would be invalid.

Thank you again.

Re: Having Trouble Resolving Error
Reply #1 - Sep 21st, 2006, 8:35am
 
There are two errors. First delete the semicolon at the end of the for line. And second, xii == xj make no sense, cause the for loop will only work if xii=xj. I think you mean xi<=xj.
Re: Having Trouble Resolving Error
Reply #2 - Sep 21st, 2006, 11:25pm
 
Thanx, but for some reason it's still giving the same error.  Any clues?
Re: Having Trouble Resolving Error
Reply #3 - Sep 22nd, 2006, 11:47am
 
Problem #1: you can't just put xi on it's onw in the first part fo a for loop, it makes no sense. the first part is for "initial conditions" e.g. for saying x starts at 0. To fix this, remove the xi just have for( ; xii == xj; xi++);

Problem #2: xii doesn't exist. You need to have declared it beforehand. This second part of the for() command is the "test" which decides wether to run the cnotents of the loop. Whilst the test is true, it runs, if it's false it ends. In your code, even if you had declared xii before, I can't see it or xj being changed within your loop, which would mean that it will never end. The test needs to be false eventually...
Re: Having Trouble Resolving Error
Reply #4 - Sep 22nd, 2006, 5:40pm
 
thank you. yeah the xii was just a typo of xi that I had fixed, but not copied and pasted.. I've got it working now.
Page Index Toggle Pages: 1