Question:
Current behavior:
Desired behavior
Repl link:
code snippet
Question:
Current behavior:
Desired behavior
Repl link:
code snippet
Welcome to Replit Ask!
It seems like this is to do with a homework task. Note we do not give homework help here, but we can give you pointers in the right direction.
Here’s a quick template for Java for loops:
for (int i = 0; i < x; i++) {
// Run this code x times
}
I’ll leave the rest to you
thank you, i did this .
for(int i=0; i<5;i++);
System.out.println("i have a dog");
it seems like the system.out.printl doesnt work
Is your code in your class Main
(or similar) block?
You have to wrap the commands in the for loop in {}
, and you cannot have a semicolon on the end of the for loop.
Here’s some examples:
for (condition) {
//Commands
}
// OR
for (condition)
{
//Commands
}