"val" wasnt't declared in this scope"

i know this is a stupid question, but i'm new at Arduino: why does it give me the error "val wasn't declared in this scope"?

#define ledPin 13
#define inPin 7

void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(inPin, INPUT);
int val = 0;
}

void loop()
{
val = digitalRead(inPin);

if (val == HIGH) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);

}
}

You define val in setup so you can't see it in loop.
Put the definition in loop (best), or outside both functions (worse)

Please remember to use code tags when posting code