Before using a variable, you must assign a value to write the following instruction to a C # program: Intz;messagebox.show ("Theansweris" +z);
Go ahead and have a try. You will receive an error and the IDE will refuse to compile the code. That's because the IDE examines each variable to determine that it has been assigned before it is used. The easiest way to prevent forgetting to assign a value is to put the declaration variable and the instruction assigned to it as a sentence.
Some useful types
Each variable has a type, which tells C # what data it can host. In the fourth chapter we will look at more details of types in C #. Now, we're going to focus on these three most popular types. An int is loaded with plastic (or integer), string bearer text, and bool-hosted Boolean value True/false.
If you write a code that uses a variable with no assigned value, the code cannot be compiled. The easiest way to prevent forgetting to assign a value is to declare variables and
The instruction assigned to it is one sentence.