From the course: Debugging in C#

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Beginner debugging code challenge: Solution

Beginner debugging code challenge: Solution

From the course: Debugging in C#

Start my 1-month free trial

Beginner debugging code challenge: Solution

(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 in the next chapter, but…

Contents