If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content
Current time:0:00Total duration:6:10

Video transcript

okay so you've made a few programs you might be wondering how on earth am I supposed to remember all of these commands is it oval or circle or lips is it width and height or is it is it height than width do I have to memorize all of this thankfully no that's what the computer is for the thing is we always have a computer with us when we're programming and a computer is really good at remembering things better than we are so what if we just have a computer remember all the details for us and we can just use it like a dictionary for programming then we can focus on making cool programs not memorize and went to boring details that's what we call documentation a document that explains how to program and particular language and environment with examples and gotchas so if we can't remember the exact details no worries we can just look them up you might think it's boring to read documentation in your a is kind of boring it's a lot more fun to write code but unless you want to memorize absolutely everything you need to learn how to use dark tation or be able to code your ideas even great programmers don't try to memorize everything in fact great programmers are usually some of the best at reading documentation for example I'm drawing a smiley face and I've already drawn the face and the eyes using ellipse a function I know pretty well but I have more work to do first I want to draw the face with thick outlines like a sticker I remember that has something to do with stroke but I don't remember exactly the name so instead of sitting here and trying to invent it which could take hours or infinity I'll just go to the documentation tab and look around and and try and find what I'm looking for and I'll look under this coloring category because that seems likely and look at all the functions here and then finally at the very end I find stroke wait to change the thickness of lines and outlines so here we see the function name and the parameters just one in this case so what I usually do is start off by just copying that code and pasting it into my code but I immediately get an error thickness is not defined that's because thickness is a placeholder parameter it's not a real value I'm meant to replace that with what I actually want it to be right so that could be with a number or a variable that refers to a number so in this case I'll just put a number in so yeah okay perfect tens nice but you know we could fiddle with that and see how that's a little extreme that's too small all right so go back twelve cool now there's something really obvious machine in my smiley face the smile so I basically just want something like this right and I can look at that smile and think well does that look like something I draw using a lips or line or rect it's got this curb to it but it doesn't have an inside so I think well I should check the docks and see if there's some other way to draw a curve like this so to the docks machine we go scrolling down scrolling down and looking around so I'll check it the shapes category uh-huh the very first entry in shapes is arc which is used for drawing an arc which sounds kind of perfect because that's what the smile is so this one has a lot more parameters in it I'll start off by pasting this in here and and you know remember these are placed solar parameters so we need to replace them with what we think they should be all right so x and y so maybe x and y is where I want it to begin so we'll say C so our middle is 200 so maybe it will start it 150 and then Y is maybe maybe 250 and then within width sounds like you know the width of the arc so it's probably a bit less than the width of the actual face so maybe it's 200 and then the height maybe that's the height from the top of the arc to the bottom so go maybe that's 50 start and stop maybe I don't I don't actually really know what those are okay so now I'm stuck because I'm looking at this function and trying to use it but I don't really understand these parameters well luckily what you can do is just go back down to the docks and actually click on the function that you're interested in and it will bring up a program that shows you how to use it and actually explains the parameters in a lot more detail so if I look at this it says okay X is the x coordinate of the center of the ellipse derived from the arc okay so basis seems like to draw an arc you kind of have to pretend you're drawing an ellipse but only part of it and calculate everything based on that so the x and y is actually the center of that pretend ellipse were making the width and the height are the width and height of that pretend ellipse and starting stop those are the ones I didn't know start and stop is the angle ah okay the start angle to start the arc at in degrees and stop is word to stop it at right and we can actually look at the examples they've done here so drawing the arc where that afield 1/2 to 70 that's probably this guy over here right because 1 degree 270 degrees that's that's what that would look like let's try changing there we go that makes sense right because then 1 to 180 that's kind of what we want right because we want our half arc okay so now I think I understand arc well enough to use it and let's go back to my smiley alright so we're going from 0 to 180 and we've almost got it my x and y is offset in rise the X is actually the middle of the ellipse and it's a little bit wide so let's go make that smaller ha ha I now have a real smiley face thanks to using the docs I was able to do what I wanted much faster and that's a goal of programming turn our ideas into reality faster remember use the power of the docs