32
loading...
This website collects cookies to deliver better user experience
At the end of this lesson, you should be able to answer the following:
Hello, World!
in double quotes (""
) for it to be a valid value. Enclosing the text in double quotes made that entire piece of data be of the string type.string
"To you, 2000 years from now"
int
99
bool
true
''
).char
'a'
double
(short for double-precision floating-point)3.1416
Console.WriteLine()
doesn't just take string values. It can also print out values of other types.Console.WriteLine()
and replacing the value in the round brackets.// String
Console.WriteLine("To you, 2000 years from now");
// Integer
Console.WriteLine(99);
// Boolean
Console.WriteLine(true);
// Character
Console.WriteLine('a');
// Floating-Point Numeric
Console.WriteLine(3.1416);
Question
What is the data type of each value below?
"true"
-24601
false
1.38064852
' '
Challenge
Try to come up with your own values for each data type! Replace the code above with your values to print them out.