190 likes | 325 Views
Variables. Mr. McTavish. One address – one piece of information. Boolean – True/False. How to Declare. bool blBoolean ; – or – Boolean blBoolean2 ; Boolean is the preferred type. How to Initialize. blBoolean = true ; – or – blBoolean2 = false ;. Integer. How to Declare.
E N D
Variables Mr. McTavish
How to Declare boolblBoolean; – or – Boolean blBoolean2; Boolean is the preferred type.
How to Initialize blBoolean = true; – or – blBoolean2 = false;
How to Declare intintInteger; – or – Int32 intInteger2; Int32 is the preferred type
How to Initialize intInteger = -7; – or – intInteger2 = 3764;
How to Declare doubledblDouble; – or – Double dblDouble2; Double is the preferred type
How to Initialize dblDouble = 3.01; – or – dblDouble2 = 1;
Output //Declare and initialize DoubledblPrice = 3.1; //Outputs as dollar Console.WriteLine(dblPrice.ToString("$0.00"));
How to Declare charchrChar; – or – Char chrChar2; Note: Char is the preferred type
How to Initialize chrChar = 'a'; – or – chrChar2 = 'Z'; Note the single quotation marks
How to Declare stringstrString; – or – String strString2; Note: String is the preferred type
How to Initialize strString = "Hello"; – or – strString2 = "A String";