Results 1 to 4 of 4
Thread: Problem with "for" loop
- 06-11-2012, 07:12 PM #1
Kraig9
- Join Date
- Jun 2012
- Location
- Central Texas
- Posts
- 3
- Rep Power
- 0
Problem with "for" loop
New to Java and programming in general... What is wrong with my loop? (In Eclipse)
package variation;
public class VariationFromCandy {
public static void main(String[] args){
for (int x=0; x>-40; x = x - 5);
System.out.println(x + "da number is"); //it gives me an error on x in (x + "da number is") edit: It states that "x cannot be resolved to a variable."
}
}Last edited by kraig9; 06-11-2012 at 07:17 PM.
- 06-11-2012, 07:16 PM #2
Re: Problem with "for" loop
Check your semicolons.
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 06-11-2012, 07:16 PM #3
Re: Problem with "for" loop
You put a semicolon after your for loop condition. It should be an opening parenthesis:
Java Code:for(int x=0; x>-40; x=x-5){ System.out.println(x + "da number is"); }
- 06-11-2012, 07:20 PM #4
Kraig9
- Join Date
- Jun 2012
- Location
- Central Texas
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
while loop repeat word until user types "stop", code problem
By JMAsterson in forum New To JavaReplies: 18Last Post: 04-03-2012, 09:49 AM -
loop "play again" in an 8 ball game , loops but wont let me answer my "out.print"
By IareSmart in forum New To JavaReplies: 1Last Post: 02-01-2012, 08:37 PM -
An "if" statement inside a "for" loop?
By soccermiles in forum New To JavaReplies: 18Last Post: 04-20-2010, 03:44 AM -
problem with argument list and precedence "(" and ")"
By helpisontheway in forum Advanced JavaReplies: 6Last Post: 12-24-2009, 07:50 AM -
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks