noob questions about declaring variables and camelback notation.

two nOOb coding questions

first question
I have noticed that many tutorials declare a variable and then assign a value in the start function. is there an advantage to this over declaring and assigning it right off?

as in:

private int amountSpawned;
private bool gameOver;
void Start ()
	{
            amountSpawned = 1;
		gameOver = false;
	}

vs:

private int amountSpawned = 1;
private bool gameOver = false;

which is better practice and why ?

2nd Question.
when I use camelback notation I always leave the first letter not capitalized “likeThis”. But I have noticed that scripts tend to be capitalised from the first “LikeThis”. Should I do it for all classes ? functions? What is the best practice here that will help my coding be clear to others?

Thanks for your help.

In general, use Start() to initialize things that are not constants. If the values are constants, assign them when you declare them. For example, you would use Start() for something like this:

private Transform trans;

void Start() {
    trans = GameObject.Find("SomeObject").transform;
}

As for capitalizing the first letter, the convention is that all variables have a lower case first letter, and that all classes and functions have upper case letters. This allows things like:

Color color = Color.white;
MyClass myClass;