Problem in Calling Functions

Hi Guys, I am new in programming Arduino and I'm facing some difficulties in calling a function. I hope you help me !

I always get this error message and I don't know how to fix it.

Safinah.ino: In function 'int First()':
Safinah.ino:36: error: expected ';' before '{' token
Safinah.ino: In function 'int Second()':
Safinah.ino:49: error: expected ';' before '{' token
Safinah.ino: In function 'int Third()':
Safinah.ino:62: error: expected ';' before '{' token
Safinah.ino: In function 'int Fourth()':
Safinah.ino:75: error: expected ';' before '{' token
Safinah.ino: In function 'int Fifth()':
Safinah.ino:88: error: expected ';' before '{' token
Safinah.ino: In function 'int Sixth()':
Safinah.ino:101: error: expected ';' before '{' token
Safinah.ino: In function 'int Seventh()':
Safinah.ino:114: error: expected ';' before '{' token

And this is my full Code

int led1 = 13;
int led2 = 12;
int led3 = 11;
int led4 = 10;
int led5 = 9;


void setup() {

  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
  pinMode(led5, OUTPUT);
}

  void loop() {
    
  int A;
  int B;
  int C;
  int D;
  int E;
  int F;
  int G;
  
 A= First();
 B= Second();
 C= Third();
 D= Fourth();
 E= Fifth();
 F= Sixth();
 G= Seventh();
}

 int First() { loop {
  digitalWrite(led1, LOW);   
  delay(1000);
  digitalWrite(led2, HIGH);   
  delay(1000);               
  digitalWrite(led3, HIGH);    
  delay(1000);
  digitalWrite(led4, HIGH);   
  delay(1000);
  digitalWrite(led5, LOW);   
  delay(1000);  
}}

int Second(){ loop {
  digitalWrite(led1, LOW);   
  delay(1000);               
  digitalWrite(led2, LOW);    
  delay(1000);
  digitalWrite(led3, LOW);   
  delay(1000);
  digitalWrite(led4, HIGH);   
  delay(1000);
  digitalWrite(led5, LOW);   
  delay(1000);
}}

int Third() {loop {
  digitalWrite(led1, HIGH);   
  delay(1000);               
  digitalWrite(led2, HIGH);    
  delay(1000);
  digitalWrite(led3, LOW);   
  delay(1000);               
  digitalWrite(led4, HIGH);    
  delay(1000);
  digitalWrite(led5, LOW);   
  delay(1000);  
}}

int Fourth() {loop {
  digitalWrite(led1, LOW);   
  delay(1000);               
  digitalWrite(led2, HIGH);    
  delay(1000);
  digitalWrite(led3, HIGH);   
  delay(1000);
  digitalWrite(led4, HIGH);   
  delay(1000); 
  digitalWrite(led5, HIGH);   
  delay(1000);  
}}

int Fifth(){ loop {
  digitalWrite(led1, HIGH);   
  delay(1000);               
  digitalWrite(led2, LOW);    
  delay(1000);
  digitalWrite(led3, LOW);   
  delay(1000);               
  digitalWrite(led4, HIGH);    
  delay(1000);
  digitalWrite(led5, LOW);    
  delay(1000);  
}}

int Sixth(){ loop {
  digitalWrite(led1, HIGH);   
  delay(1000);               
  digitalWrite(led2, HIGH);    
  delay(1000);
  digitalWrite(led3, HIGH);    
  delay(1000);
  digitalWrite(led4, HIGH);    
  delay(1000);
  digitalWrite(led5, LOW);    
  delay(1000);  
}}

int Seventh(){ loop {
  digitalWrite(led1, LOW);   
  delay(1000);               
  digitalWrite(led2, HIGH);    
  delay(1000);
  digitalWrite(led3, LOW);    
  delay(1000);
  digitalWrite(led4, HIGH);    
  delay(1000);
  digitalWrite(led5, LOW);    
  delay(1000);  
}}

loop is a function name, you cannot use it that way

please read - http://arduino.cc/en/Tutorial/ForLoop - I think that is what you need.

And try to keep your sketches minimal and test them after every small addition.
small programs → small bugs
big programs ->…

Take a look at the examples that come with the Arduino IDE to get some experience and an understanding of how things are done. Also take a look here http://arduino.cc/en/Tutorial/HomePage

robtillaart:
loop is a function name, you cannot use it that way

please read - http://arduino.cc/en/Tutorial/ForLoop - I think that is what you need.

And try to keep your sketches minimal and test them after every small addition.
small programs → small bugs
big programs ->…

Thanks a lot.
But my problem is that I want to know what is the correct way to call a function ?

But my problem is that I want to know what is the correct way to call a function ?

You are calling the functions correctly. They are garbage, though.

Google is your friend.

http://arduino.cc/en/Reference/FunctionDeclaration

You’ll find that, most of the time, the goal of the people who answer your questions is not to give you the answer, but to direct you towards self-discovery. First, you need to learn how to use arrays. They will make your code a lot simpler. Second, in loop(), you define int’s A - G, but never use them, so you may as well get rid of them. Third, a statement like:

 A= First();

assumes that the function named First() returns an int value…none of your functions return anything, so it makes no sense to use them in an assignment statement. Finally, study how to use arrays and see how they can ease your code burden:

#define PAUSE 1000
#define ARRAYELEMENTCOUNT(x) (sizeof(x) / sizeof(x[0]))    // Calculates the number of elements in array x

int LEDS[] = {13, 12, 11, 10, 9};

int Sequence[7][5] = {
  {LOW, HIGH, HIGH, HIGH, LOW},
  {LOW, LOW, LOW, HIGH, LOW},
  {HIGH, HIGH, LOW, HIGH, LOW},
  {LOW, HIGH, HIGH, HIGH, HIGH},
  {HIGH, LOW, LOW, HIGH, LOW},
  {HIGH, HIGH, HIGH, HIGH, LOW},
  {LOW, HIGH, LOW, HIGH, LOW}
};

void setup() {
  int i;
  
  for (int i = 0; i < ARRAYELEMENTCOUNT(LEDS); i++) {
    pinMode(LEDS[i], OUTPUT);
  }
}

void loop() {
  int i;
  
  for (i = 0; i < ARRAYELEMENTCOUNT(LEDS); i++) {
    StrobeTheLEDS(i);
  }
}


void StrobeTheLEDS(int whichRow)
{
  int i;
  
  for (i = 0; i < ARRAYELEMENTCOUNT(LEDS); i++) {
    digitalWrite(LEDS[i], Sequence[whichRow][i]);
    delay(PAUSE);
  }
}

I can’t test the code above, but at least you can see how arrays can help you.