error Msg during tutorial...Cant find any mistakes but still get errors(SOLVED)

Well I have the "exploring arduino" book and im working on the tutorial that allows to check for button states with Bouncing buttons. I followed the tutorials so far and have had minimal issues. This time, I have triple and quadruple checked the code and do not see the error. can someone double check it for me and present guidance.

Code is as follows:

const int LED=9; // The LED is connected to pin 9
const int BUTTON=2; // The Button is connected to pin 2
boolean lastButton = LOW; // Variable containing the previous button state.
boolean currentButton = LOW; // Variable containing current button state.
boolean ledOn = false; // The present state of the LED (on/off)
void setup()
{
** pinMode (LED, OUTPUT); // Set the led pin as an output**
** pinMode (BUTTON, INPUT); // Set button as input (not required)**
}
/*
* Debouncing Function
* Pass it the previous button state,
* and get back the current debounced buttion state.
*/
boolean debounce(boolean last)
{
boolean current = digitalRead(BUTTON); // Read the button state
if (last != current) // If it's different...
{
** delay(5); // 5ms wait**
** current = digitalRead(BUTTON); // Read it again**

** return current; // Return the current value**
}
void loop()
{
** currentButton = debounce(lastButton); // Read debounced state**
** if (lastButton == LOW && currentButton == HIGH) //if it was pressed...**
** {**
** ledOn = !ledOn; //toggle the led value**
** }**
** lastButton = currentButton; // reset button value**

** digitalWrite(LED, ledOn); // change the led state**
** }**

Error: A function definition is not allowed here before '{' token

The compiler is correct (amazing or what?)
Match your { to your } and you'll see the problem

Please get into the habit of using code tags when posting code.

Ok I will try to change them around some. I tried earlier but i will ry again. Shorthand the way it os now I understand this:

void loop()
{currentButton = debounce(lastButton); if (lastButton == LOW && currentButton == HIGH) {ledOn = !ledOn; } lastButton = currentButton; digitalWrite(LED, ledOn); }

This is how I understand the code needed as explained in the book.

I tried to consolidate the {} to "{currentButton = debounce(lastButton);}" But that did not work...

Am I misunderstanding the "void loop() {}" command??

Start at:-
boolean debounce(boolean last)
Count the number of { and the number of } until you get to the next function the loop one.
What do you see?
Is it correct?

No, sorry, either the forum software mangled your last post, or it didn't make much sense in the first place.

Please use code tags.

AWOL!!!! Your AWESOME!!!! Thank you for the pick-me-up. Your response had me go back and relook at the entire code and I found the mistake. It was earlier in the code than I had anticipated. I just added the missin "}" and the compile did not yell at me. Thank you again AWOL XD

Thank you as well Grumpy Mike. you guys were spot on.

Sorry AWOL I do not know how to use code tags..? Can you instruct me please?

Read the how to use this forum sticky post.

Ok Will do Grumpy Mike. Thank you guys, I apologize for posting before reading the rules. I just got over excited about solving this issue. I will behave accordingly from now on :%