for loop in void setup

Can anyone help please.

I want to run a for loop in void setup but get the error that "j" was not declared in this scope.

I have declared "welcome" as a global int with a value of 3

I wanted the welcome message to print 3 times before the void loop starts.

int welcome=3;

void setup() {

pinMode (GR, OUTPUT);
pinMode (BL, OUTPUT);
Serial.begin(19200);
String start1 = " This is the start";
String start2 = " of the first loop";
String combine;

combine = start1+start2;

for (int j=1; j<=welcome; j=j+1);{
Serial.print (j);
Serial.println (combine);
}

}

Thanks
JavBBV

seutp is a function, not a void. void is the return type declaration, it means "this function doesn't return anything".

Your error is in this line:

  for (int j=1; j<=welcome; j=j+1);{

Look carefully at it and compare to a working piece of code...

MarkT:
Your error is in this line:

  for (int j=1; j<=welcome; j=j+1);{

Look carefully at it and compare to a working piece of code...

Like the line in this example.

Spotted thanks and there was me thinking I was being good by putting a ; at the end of everything... LOL :slight_smile:

seutp is a function, not a void.

Personally, I'm not sure what "seutp" is.