problems with variables

so i adapted a tutarial from the refrence board to see it i could randomly dim a led ... how ever when i run the new code i get "randNumber not declared in this scope"

void setup(){
Serial.begin(9600);
pinMode(11,OUTPUT);

randomSeed(analogRead(0));
int randNumber = 0;
}

void loop() {
// print a random number from 0 to 299
int randNumber = random(300);
Serial.println(randNumber);
analogWrite(11,randnumber);
// print a random number from 10 to 19
randNumber = random(10, 20);
Serial.println(randNumber);

delay(50);
}

brenden_nerd_:
so i adapted a tutarial from the refrence board to see it i could randomly dim a led ... how ever when i run the new code i get "randNumber not declared in this scope"

In your loop function you declare 'randNumber', but you try analogWrite 'randnumber'.

Be careful with uppercase/lowercase spelling!

'randNumber', 'randnumber', 'RaNdNuMbEr' and "rAnDnUmBeR' are completely different identifier names in the C/C++ programming language!

i tend to forget this language is case sensitive

You also tend to read/print error messages as you believe they are rather than as they really are. This is why this forum prefers copy and paste. I think that the error message was closer to:

"randnumber not declared in this scope"

(Notice that the letter N in the middle of randnumber is NOT capitalized.)

although there are still parts missing.

brenden_nerd_:
i tend to forget this language is case sensitive

Also English, apparently.