Data types Flashcards
Boolean data type
A type of variable which has only one of two values: true or false.
Example
bool Answer;
Answer=True;
Integer data type
A type of variable that can contain whole numbers
Example
integer cakes;
cakes = 12;
Float data type
A type of variable that can contain numbers with a decimal point
Example
float race_time;
race_time = 9.98;
String data type
A type of variable that can contain a number of characters or string
Example
string shout;
shout = “I am angry”;
Unsigned short integer data type
A type of variable that can hold positive whole numbers
Example
ushort weekdays;
weekdays = 7;
Class
A data structure that combines different elements
Example
class car ( int number_of_doors = 4; int number_of_wheels = 4; str colour = "green"; )
Object
An implementation, example or instance of a class
e.g. if the class is a car, a black jaguar is an object
Syntax
The structure of the language - like sentences, full stops, commas, quotation marks
Example: An if statement has a condition in () and the consequence in braces/curly brakets
.NET framework
Libraries of code pre-built by Microsoft that you can use in Visual Studio
e.g. System includes functions for maths, e.g. Math.Abs() is a method that returns the absolute value (just the positive value) of what is in the brackets.
Math.Abs(-7) = 7
Common Language Runtime (CLR)
Protective bubble that enables your code to run without impacting on other open windows but using the hardware of the computer. Prevents the software developer from doing damage to the computer.
Comments
Useful text that allows coders to understand how code is planned to work
Example
counter = counter + 1; /* increment the frame counter each iteration */
Indentation
How much text is moved from the left edge of the screen
Example
if(Tristan==’drunk)
(
Console.WriteLine(“Tristan is drunk”);
)
method
a block of code that can be called by its name and passed parameters
Example
print_text(string)
(
Console.WriteLine(string);
)
print_text is a method
string is the parameter that is passed
namespace
A block of code containing classes which may contain methods
Example
namespace HelloWorld
(
block of code with class Program
)
class Program is inside namespace HelloWorld
member access
The “.” in naming of methods
Example
Console.ReadLine(),
Access the method ReadLine in the class Console (N.B. Console is a class defined in the .NET framework in the library called System)