1/43
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is a low level programming language?
Binary. Harder to understand but more efficient language.
What is a high level programming language?
Easier to understand but less efficient. Example: C#
Which kind of language is C#?
High level programming language.
What are variables?
Stores information in your program.
What is a primitive data type?
A very basic data types. Example: Numbers, True and False, Characters.
What are some basic primitive variables used in C#?
int (integer), bool (boolean), char (single character), float (number with decimal)
How do you declare a variable?
public/private, type of variable, name of variable, then ;
What is an if statement?
A condition statement. If this is true, then execute the code.
How do you write an if statement in C#?
if (condition)
{
block of code
}
How do AND and OR work?
And is && and or is ||. Conditional.
How do you use a while loop?
while();
{
}
How do you use a for loop?
for(int i = 0; i < iterationCount; i++)
{
what you want to loop
}
How do you use a switch statement?
switch()
{
case
}
What is a function/method?
Block of code that does something. The type, the name, then the parameters.
How do you create a function/method?
public void NameOfFunction()
{
}
How do you call a function/method?
void Update()
{
randomName();
}
What is a recursive function/method?
A function that calls itself to calculate a result.
What is an enum?
A list of options/named values.
What is an int?
An integer. A whole number (no decimals)
What is a float?
A number that is a decimal/ fraction numbers.
What is a string?
A sequence of multiple characters.
What is a class?
A fundamental block of C# programming that defines a blueprint for object. Huge instruction of code.
Example:
public class raycast : MonoBehaviour
f after a number is means that the number is a
float
void Awake()
is called first, just after a prefab is instantiated.
void Start()
is called before the first frame update.
void Update()
is called once per frame.
void FixedUpdate()
is called 60 times a second, independent of the framerate.
void LateUpdate()
is called after after update.
What is a Static Variable?
A type of variable that only exists in that class that its attached to. For Example:
If you have a static variables for house called Material and set it to stone from bricks, every house in the level would then have those same materials.
What is a Static Method?
A function that belongs to the class itself, not to any one instance. It can be called directly from the class, without needed a specific object. They can’t act on individual instances unless you pass the instance to them as a parameter.
What is an Object?
An existing thing that can have attributes and methods attached.
What is an Instance?
A single occurrence of a class. An individual object made from that said class. For example:
A class is a blueprint of a house and an instance is a house made from that blueprint.
How do you use an Enum?
enum (name of enum goes here)
{constant/value #1, constant/value #2, constant/value #3, etc}
note: constants are read only variables / named values.
How do you write a comment in C#?
Write // before the line of code to comment out the entire line. To comment out multiple lines, use /* before the group of comments and */ after to close the comment.
How do you use a for each loop?
Specifically used for going through an array.
What is an Array?
Holds variables.
How do you use an Array?
Firstly, the array type with brackets, then the name of said array, then equal sign, then curly brackets containing the names of the variables/objects, finishing with semicolons. For example:
string[] cars = {"Volvo", "BMW", "Ford", "Mazda"};
or
int[] myNum = {10, 20, 30, 40};
What is a Sorting Algorithm?
Sorts an array/list into a more orderly fashion. For example:
Original: [10, 3, 4, 7]
After Sorting Algorithm: [3, 4, 7, 10] or [10, 7, 4, 3]]
What is a Two Dimensional Array?
Two axis list.
Example:
[0,0] [1,0] [2,0]
[1,0] [1,1] [1,2]
[2,0] [2,1] [2,2]
What is a List?
Holds objects and its information.
What is whitespace in C#
Any space or lines with no code in code editors like Visual Studio. Doesn’t change the code itself.
Why use a for loop?
Great to use for code that’s set to run a specific number of times. While loops can also be used in the same way, but for loops works better/ more efficient in this case.
What is a switch statement?
A type of statement where it goes through different cases in a switch expression. Example:
int day = 4;
switch (day)
{
case 1:
Console.WriteLine("Monday");
break;
case 2:
Console.WriteLine("Tuesday");
break;
case 3:
Console.WriteLine("Wednesday");
break;
case 4:
Console.WriteLine("Thursday");
break;
case 5:
Console.WriteLine("Friday");
break;
case 6:
Console.WriteLine("Saturday");
break;
case 7:
Console.WriteLine("Sunday");
break;
}
// Outputs "Thursday" (day 4)
What does void mean when declaring a method?
That the method has no returning value.