Learn how to find all of the errors in the previous code by using breakpoints, the call stack, and the Locals window in this video. Also, discover which types of errors are easy to find and which are harder to find.
(upbeat music) … - [Instructor] Let's walk through this code … and see what errors we can solve. … First we'll see if we can run the program. … And we get an error, we can scroll up here … in the console and see what error we get. … The type or namespace name integer could not be found. … Hmm, so let's scroll down our code here, … and we see this squiggly line in our integer, … probably a problem, and what this really should be is int. … You might be thinking why choose int. … There are things we could have made this variable, … why does it have to be an int. … Well if we look at what find min returns, … it returns an int, so those two should be matching, … because we put the value of find min, whatever that returns, … with the given input numbers, into the variable min, … and since find min returns a int, min should be an int. … Let's see if we can run the code now, … does it complete its execution. … And we get another error, IndexOutOfRangeException. … We'll talk more about what this error means …
- Debugging defined
- Working with breakpoints
- Inspecting values of variables
- Defensive programming
- Common C# errors
- Debugging challenges