Chapter 3, Getting into the Details of Variables

Pop quiz – knowing how to declare a variable

Q1

Begin the name with a lowercase letter. For multiword names, a variable can only be one actual word, so spaces are removed between the words, and then capitalize the first letter of each word.

Q2

Declare the variable as public.

Q3

No, only member variables can be public.

Q4

A variable can only store one type of data, which has to be specified when it's declared.

Get Learning C# by Developing Games with Unity 3D Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.