this video is brought to you by Squarespace Squarespace is the all-in-one shop to build a beautiful online presence and run your business launch your passion project with Squarespace hello I hope you're having a great day so far today you and I are going to be learning about method parameters and arguments so let's start learning about method parameters and arguments by going to file new project as every single video starts off we're gonna call it method params hit finish and then inside there throw a class in it as pretty huge call it params again some main method boom there may be a little familiar with what a method looks like a method has these keywords some parentheses and then curly braces so this main method is a method what's inside the parentheses are what's called the parameters it's how you pass information into your method if we have a method that says hi called maybe say hi and all it does is print out hi and then we call say hi in the main method what it'll do is it'll run the code inside of say hi which is just print out the characters H I and this is pretty sweet it has everything a method needs it has keywords in the front it has a name it has parentheses and curly braces and it's implemented meaning there's code inside of the curly braces but notice how there's no there's nothing inside the parentheses that is perfectly fine a method does not have to have anything inside the parentheses and it can work just fine but what if we wanted this say hi method to print say anything like if I wanted to print my name right now without any parameters I'd have to make another method called like say Alex and then print out Alex and then I'd have to change this and instead call the say Alex method to print out Alex now if I want a quick easy way to print something out through a method I could just tell the method what to print out and then pass that as a variable so let me show you what I mean so instead of this say hi we can say call it say something the name doesn't really matter here but it helps us understand what the method does so now instead of passing nothing and assuming we're always going to pass hi what we can do is write the type of variable we want to pass into our method for this example since we'll be doing a string we can write string say call it s this can be any name now everything inside these curly braces knows that there's a variable s that exists when the method is called so if I put s into here we don't get any red underlines because it knows that s exists and it has to be passed into the method so now if this was say something there'd be red underlines because there's nothing in the parentheses we need something in here to match this string s parameter that's where we would put what we want to say since this is a string since it's inside of double quotes and this parameter is a string then we get no red underlines and it'll work as expected so if we run this it'll print out what we pass in the parameter quick terminology this inside the parentheses of the method is called the parameter this stays the same in the method it's always going to be called string s inside the method this is the parameter it stays the same well you're going to be putting inside the changes so if
START_SPONSOR_TOKEN this video is brought to you by Squarespace Squarespace is the all-in-one shop to build a beautiful online presence and run your business launch your passion project with Squarespace hello I hope END_SPONSOR_TOKEN