Issues "Lesson 11 Eight LED with 74HC595"

I running through the basic projects with my Mega 2560 project kit and ran into a problem with one. The amber LED on the board flashes but nothing responds on the board and I get the error. Here is my error copied-

Arduino: 1.8.9 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\cdr14\Desktop\Elegoo Basic Starter Kit for Mega 2560 V1.0.2019.03.04\code\Lesson 11 Eight LED with 74HC595\Eight_LED_with_74HC595_Flash_LED\Eight_LED_with_74HC595_Flash_LED.ino: In function 'void updateShiftRegister()':

Eight_LED_with_74HC595_Flash_LED:16:4: error: expected initializer before 'digitalWrite'

digitalWrite(latchPin, HIGH);

^

C:\Users\cdr14\Desktop\Elegoo Basic Starter Kit for Mega 2560 V1.0.2019.03.04\code\Lesson 11 Eight LED with 74HC595\Eight_LED_with_74HC595_Flash_LED\Eight_LED_with_74HC595_Flash_LED.ino: At global scope:

Eight_LED_with_74HC595_Flash_LED:26:1: error: expected unqualified-id before '{' token

{

^

exit status 1
expected initializer before 'digitalWrite'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Here is the coding from the project, I havent changed anything

//www.elegoo.com
//2016.12.9

int tDelay = 100;
int latchPin = 11; // (11) ST_CP [RCK] on 74HC595
int clockPin = 9; // (9) SH_CP [SCK] on 74HC595
int dataPin = 12; // (12) DS [S1] on 74HC595

byte leds = 0;

void updateShiftRegister()
{
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, leds);
void loop()
digitalWrite(latchPin, HIGH);
}

void setup()
{
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
}

{
leds = 0;
updateShiftRegister();
delay(tDelay);
for (int i = 0; i < 8; i++)
{
bitSet(leds, i);
updateShiftRegister();
delay(tDelay);
}
}

Image url-

Any ideas?? Thanks in advance.

void setup() 
{
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);  
pinMode(clockPin, OUTPUT);
}

{
leds = 0;

Oops.
Did you forget the loop function?
Please remember to use code tags when posting code

You appear to have a 'void loop()' in the middle of your 'void updateShiftRegister()'.

Steve

I tried making above change but nothing, i'm not sure I did it correctly though, and keep in mind I am VERY new to coding. The hardware part is easy but these are pre written codes I'v pasted in from Elegoo so if it looks wrong I need corrections suggested in very laymen terms until I figure this out lol. I tried a different simple project to make sure it wasn't a hardware issue and it worked fine. Here's the code again. Thanks

<//www.elegoo.com
//2016.12.9

int tDelay = 100;
int latchPin = 11; // (11) ST_CP [RCK] on 74HC595
int clockPin = 9; // (9) SH_CP [SCK] on 74HC595
int dataPin = 12; // (12) DS [S1] on 74HC595

byte leds = 0;

void updateShiftRegister()
{
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, leds);
digitalWrite(latchPin, HIGH);
}

void setup()
{
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
}

{
leds = 0;
updateShiftRegister();
delay(tDelay);
for (int i = 0; i < 8; i++)
{
bitSet(leds, i);
updateShiftRegister();
delay(tDelay);
}
}>

You are still missing a loop function.

And code tags.

You need the void loop() after the setup section, apparently you accidentally moved it at some time.

Here is the complete sketch as downloaded from Elegoo's website (obviously copyright Elegoo, no infringement intended)

//www.elegoo.com
//2016.12.9 

int tDelay = 100;
int latchPin = 11;      // (11) ST_CP [RCK] on 74HC595
int clockPin = 9;      // (9) SH_CP [SCK] on 74HC595
int dataPin = 12;     // (12) DS [S1] on 74HC595

byte leds = 0;

void updateShiftRegister()
{
   digitalWrite(latchPin, LOW);
   shiftOut(dataPin, clockPin, LSBFIRST, leds);
   digitalWrite(latchPin, HIGH);
}

void setup() 
{
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
}

void loop() 
{
  leds = 0;
  updateShiftRegister();
  delay(tDelay);
  for (int i = 0; i < 8; i++)
  {
    bitSet(leds, i);
    updateShiftRegister();
    delay(tDelay);
  }
}

Ahhhh thank you, yes it uploaded with no errors now. I must have changed it somehow. Thanks for the help!