Signed
- sbyte -128 to +127
- short -32768 to +32767
- int - 2^31 to +2^31-1
- long -2^63 to +2^63-1
UnSigned
- byte - 0 to 255
- ushort - 0 1o 65535
- uint - 0 to 2^32-1
- ulong - 0 to 2^64-1
- int - hexadecimal (base 16)
Floating point
- float
- double
- decimal
Char
- char
Boolean
- bool
String
- string
###########################################################################
Variables of the same type can be declared sequentially, when separated by commas:
int myInt1 = 10, myInt1 = 101, myInt1 = 500000, myInt1 = 8,
int can be any kind of number except a floating point
String FirstString = "";//<--This is the identifier = "";
String SecondString = "";//I could allocate now if I wanted
//Or I can allocate data to the string var later in the program like this
FirstString = "Lorem";
SecondString = "Ipsom":
In the case of a constant: it must be initializedConst String FirstString = "Sit Amet";
This is helpful in a large program so you don't accidentally change something that shouldn't be changed.
Float DeciNumber = 3.14f;//You need an F here
Double can hold more memory and is like a bigger version of float
Double DeciNumber = 3553435.34531112;//You dont need an F here
Boolean //Chicken Flavored
bool Tralse = false;
if (Tralse) {
run this statement;
} //This statement will not run because because it is false. If tralse were set to true it would run.
bool Tralse;
Tralse = (42 < 48);//You can also put a series of conditions in here joined by logical operators
if (Tralse) {
run this statement;
} //This statement will run because because it is true.
No comments:
Post a Comment