C# Playyer Guidee Flashcards

1
Q

What does the clamp function do?

A

If that value is lower than
the range, it produces the low end of the range. If that value is higher than the range, it
produces the high end of the range:
health += 10;
health = Math.Clamp(health, 0, 100); // Keep it in the interval 0 to 100.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

MathF

A

The MathF class provides many of the same methods as Math but uses floats instead of
doubles. For example, Math’s Pow method expects doubles as inputs and returns a double
as a result. You can cast that result to a float, but MathF makes casting unnecessary:
float x = 3;
float xSquared = MathF.Pow(x, 2);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
A

string username; // Declaring a variable
username = Console.ReadLine(); // Assigning a value to a variable
Console.WriteLine(“Hi “ + username); // Retrieving its current value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How is a variable declared?

A

A variable is declared by listing its type and its name together

string username;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an integer?

A

An integer is a whole number (no fractions or decimals) but either positive, negative, or zero.

-5, 1, 5, 8, 97, and 3,043

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

type concept

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

=

A

That = symbol means assignment, not equality.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Third, variable assignments are also expressions that evaluate to whatever the assigned value
was, which means you can assign the same thing to many variables all at once like this:

A

a = b = c = 10;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

c = 10 is an expression
Is this an expresion?

A

c = 10 is an expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

c = 10 is an expression
Is this an expresion?

A

c = 10 is an expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly