Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Ahhhhhhhhh... I'ma hate'n da Java Maan
Closed Thread
Old 08-23-2006, 10:15 PM   #11 (permalink)
patonb's Avatar
 
Master Techie

Join Date: Jan 2005

Location: In Gov't Regulated Cubical

Posts: 2,752

patonb has a spectacular aura aboutpatonb has a spectacular aura about

Default

Quote:
Originally posted by jaeusm
You have a subtle syntax error -- a semicolon after your 'for' loops. Your 'i' variable is out of scope. You defined 'i' within the scope of the 'for' loop, meaning that it only exists for the duration of the 'for' loop. The semicolon immediately following the 'for' declaration essentially means that you're looping around an empty statement. So, for each iteration, you will execute the following statement:
Code:
;
After the for loop has exited, the variables defined in the 'for' declaration -- your 'i' variable, in this case -- are now out of scope.
Thus, when the compiler sees 'i' being used to index an array, it no longer exists.

The moral: remove the semicolons after your 'for' loop declarations.
OH MY FVCK........... I FEEL LIKE AN IDIOT!........... BAH

Thanks jaeusm ........... Such a stupid error........ I even remember when it happened... Put ";" instead of "{" and must have missed the delete........

Fjf314........ the book did it for space, and I remember doing it in C and Fortran so it didn't phase me as one long code.

Ayoe fix my other GUI issue
patonb is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On