Time for action – create if statements with more than one condition to check
- Modify
LearningScript
as shown in the next screenshot. - Save the file.
- In Unity, click on Play.
Note
Notice line 11 is using the AND operator, and line 16 is using the OR operator.
What just happened?
Here is the output you get in the Unity Console:
Code analysis:
- The code on line 8 and its description:
bool theBearMadeBigPottyInTheWoods = true;
A
bool
variable is declared and assigned the value oftrue
. - The code on line 9 with its description:
int temperature = 40;
An
int
variable is ...
Get Learning C# by Developing Games with Unity 3D Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.