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)
argument/parameter
another word for the variables that are passed into a method. Also called a parameter
Example
Console.WriteLine(string);
string is the argument/parameter passed into the method WriteLine in the class Console
Solutions
A collection of projects and files that make a complete software development. Structure is provided as a template in Visual Studio. Solutions can be explored with the Solution Explorer in Visual Studio.
Example
FishORama.sln containing two projects
Project
Collection of resources e.g. .cs files, image files, configuration files that make up a part of a solution. Project get compiled into a .NET assembly.
Example
FishORama
declaring variables
code that defines what variables are required later in the program
e.g. int counter = 1;
define an integer variable called counter and sets its initial value to 1
main()
The method that is at the core of every C# project. There will only be one main() statement in the project.
Example
static void Main(string(),args)
(
Console.WriteLine(“Hello World”);
)
assignment operator
”=”
this assigns what is on the right hand side and assigns it to the left hand side
Example
y = x +3;
variable y is assigned the value from variable x plus 3
concatenation
A long way of saying we combine things in sequence
Example
Concatenating “Tristan” and “Weir”, leads to “Tristan Weir”
naming convention
the rules that we apply to determine the names, e.g. of variables
Example
Camelcase naming convention uses combined words to form variable names & requires that you use a small letter for the first word and capital letters for subsequent words in the variable. This is intended to make it more readable.
int myLoopCounter; /* counter for loops */
intellisense
A feature of Visual Studio that gives you helpful prompts
Example
When typing in the name of a variable, intellisense shows you the existing options and allows you to select one to ensure you get the correct name and the right spelling