WHAT IS HAPPENING

ok so i am a beginner and i am trying to make a sketch and anyway could anyone tell me what is happening here

void setup(){ int q = 0;
pinMode(6, OUTPUT);
pinMode(13, OUTPUT);

while(q > 3){
digitalWrite(13, HIGH);
digitalWrite(6, HIGH);
digitalWrite(4, HIGH);
++ q;}

void loop(){
digitalWrite(13, HIGH);
digitalWrite(6, LOW);
digitalWrite(4, LOW);
delay(500);
digitalWrite(13, LOW);
digitalWrite(6, HIGH);
digitalWrite(4, LOW);
delay(500);
digitalWrite(13, LOW);
digitalWrite(6, LOW);
digitalWrite(4, HIGH);
}

and this is the error message

/Arduino project/My_Program_Blink2/My_Program_Blink2.ino: In function 'void setup()':
My_Program_Blink2:13: error: a function-definition is not allowed here before '{' token
void loop(){
^
My_Program_Blink2:25: error: expected '}' at end of input
}
^
exit status 1
a function-definition is not allowed here before '{' token

This is your Sketch is it?

For every{ you need }

If you format your code in a way which is readable, the problem becomes more obvious.

void setup()
{
	int q = 0;
	pinMode(6, OUTPUT);
	pinMode(13, OUTPUT);

	while(q > 3)
	{
		digitalWrite(13, HIGH);
		digitalWrite(6,  HIGH);
		digitalWrite(4,  HIGH);
		++ q;
	}


void loop()
{
	digitalWrite(13,  HIGH);
	digitalWrite(6,  LOW);
	digitalWrite(4,  LOW);
	delay(500);
	digitalWrite(13,  LOW);
	digitalWrite(6,  HIGH);
	digitalWrite(4,  LOW);
	delay(500);
	digitalWrite(13,  LOW);
	digitalWrite(6,  LOW);
	digitalWrite(4,  HIGH);
}

You have one blinding error and a few other less obvious errors (won't do what you want). After you fix your missing bracket (blinding error), take a look at your while loop logic and commands (less obvious errors).

I prefer the Allman style of indenting even though it isn't technically the correct code convention style for C languages. The Allman style makes the brackets line up in the same column and makes their absence obvious.

FYI
http://astyle.sourceforge.net/astyle.html

Thanks to OldSteve!
in IDE 1.69
Place this in: formatter.conf
--style=allman / --style=bsd / --style=break / -A1

# This configuration file contains a selection of the available options provided by the formatting tool "Artistic Style"
# http://astyle.sourceforge.net/astyle.html
#
# If you wish to change them, don't edit this file.
# Instead, copy it in the same folder of file "preferences.txt" and modify the copy. This way, you won't lose your custom formatter settings when upgrading the IDE
# If you don't know where file preferences.txt is stored, open the IDE, File -> Preferences and you'll find a link

mode=c

# 2 spaces indentation
indent=spaces=2

# also indent macros
indent-preprocessor

# indent classes, switches (and cases), comments starting at column 1
indent-classes
indent-switches
indent-cases
indent-col1-comments

# put a space around operators
pad-oper

# put a space after if/for/while
pad-header

# if you like one-liners, keep them
keep-one-line-statements

remove-comment-prefix

--style=allman / --style=bsd / --style=break / -A1

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. Using code tags and other important information is explained in the How to use this forum post. Please read it.

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read.

Setup only runs once. Meaning q starts off at 0, and never changes, because 0 is not >3. What should be q++ would have to go outside of that bracket to actually increment. But again since it's in Setup, q would only start at 0 and then go to 1.

Don't put that stuff in Setup. All you need in Setup is the pinMode for all 3 pins (which you've neglected pin 4).