hi in this video we're gonna introduce you to the basics of debugging so the bugging can kind of be like playing Where's Waldo where you're looking for a very small detail or something that's just not quite right in a big program so let's introduce our first two debugging strategies the first one is attention to detail because even the smallest syntax error could be the source of the problem something as small as a typo and the second is questioning assumptions because sometimes the thing we are so sure can't be the source of the problem actually is we need to make sure the question and test everything so let's take a closer look at attention to detail what that means is that in our programs we need to get the details exactly right that even if something's just a little bit off the program might not run but it's easy for things to slip by so we need to look for typos or small errors which could come in the form of a typo in a variable name a syntax error and a function an if statement or a loop we could have valid code just that isn't what we meant to write or we could have other accidental mix-ups let's dive more into questioning assumptions see the computer isn't likely making a mistake it's just doing it what you told it to do so it's not doing what we want it means that we probably told to do the wrong thing so this means likely we've overlooked something we could have overlooked something as simple as the problem description we may have made a mixup on our pre and post conditions that we thought the Carroll was ending up a one-state before start a new function and that just wasn't the case the code might not actually be doing what we think it does and we might have made some assumption that something worked that was actually broken we might be so sure the problem is in one part but it's actually in an area that we haven't been looking at so remember tricky bugs often have simple sources whether it's in a ten line Carol problem or in a million line codebase these core strategies attention to detail and questioning assumptions are the two best tools for any programmer so the first step is just to always double check your code so let's debug a problem together okay so in this exercise we were getting Cairo to run laps and so we're sensory trying to and with 8 balls in the corner run 8 left so relatively straightforward running the racetrack we can see we have a loop here to run a lap and each lap is running our sides and a side says ok while the front is clear move and put a ball when you get to the corner and turn left and you're ready to start the next side so let's see what happens when we try to run this so this is bad air on line 16 so it doesn't want to run so if we look at line 16 what we notice is you know we didn't have a good attention to detail we forgot our parentheses so we still have 4 iron range that looks right but remember we need to add parentheses around it that's our correct syntax for our for loop so now with that in place we should hopefully loop eight times in our lap and so let's go ahead and try that yeah must be Carol up there and Carol gets to the end good job Carol all right so that worked let's take a look at another example here so now again same same exercise trying to get Carol to run eight laps if we have Carol run here we'll see what happens and Carol goes so it looks like everything's working fine we'll see if we get to the end here hello Carol ran too many laps so we need to look it says there should be only a pause but there's ten balls in these different positions um so we look let's see what's going on here so we have run side well that looks right run lap well it looks like we have too many in our range here so we're running a lap fort we're running five sides in our lap or our laps should only have four sides in it so let's go back and reset that to four and then we'll give that a try so now let's reset our world and run that again I don't care always off to the races once again oh and this time Carol stopped at the right spot so again another example where attention to detail is important especially you know when you're doing loops we remember that if it says four eyes going from zero to one to two to three is gonna do four times we need to make sure we're getting those details right otherwise we can get errors and we saw sometimes we get errors where the code doesn't run and other times we get errors like this where the code actually runs but we don't get the actual correct results so this is kind of a start of our debugging and you're gonna take off from here