Page 1 of 1

whats wrong with this?

Posted: Fri Oct 17, 2008 6:23 am
by recci
This is just generic code and has 5 things wrong with it. What are ?

Code: Select all

 
var a = 5;
var b = 10;
 
for(i  == 0; 1 < 10; i++)
{
    print(i + a):
)
 
var c = (a*2) - 10;
var d = b / c;
 
print(d);
 
So far Iv spotted :

1. the missing }
2. the : instead of ;
3. i == 0 should be i = 0
4. it should be i < 10
5. unsure?

does that look correct so far?

Re: whats wrong with this?

Posted: Fri Oct 17, 2008 6:28 am
by onion2k
var c = (a*2)-10 is going to give you a value of 0 ... which means var d = b / c will result in a divide by zero error.

Re: whats wrong with this?

Posted: Fri Oct 17, 2008 6:35 am
by recci
yeah that's what I thought

Re: whats wrong with this?

Posted: Fri Oct 17, 2008 10:41 am
by pickle
Don't get us to do your homework.