Learn C++ With Me #20 - Functions
Key Takeaways
This video tutorial covers the basics of functions in C++, including defining functions, passing parameters, and returning values. It also discusses the importance of using functions to separate logic in code and make it more efficient.
Full Transcript
hello everybody and welcome to another c plus plus tutorial for beginners in this video i'm going to be covering functions now functions are extremely important they're the first time we're really going to see now why we had to learn a ton of the stuff that we did well anyways let's dive into the video and discuss functions [Music] so you may remember that at the very beginning of this series i mentioned that this right here int main is a function and i said this is a special function works a little bit differently than other functions that we're going to see but this is indeed a function and now i'm going to show you how we can make our own functions but first let's quickly describe kind of what a function is and what the point of it is so a function is really just a block of code and this is something that is reusable and functions can take in what's known as parameters or arguments so you can pass some information to a function it can do something with that and it can return to you a value however a function does not need to just take information and return stuff it can also just do something on its own for example you may have a function that closes the program you may have a function that asks the user for some input a function does not always need to say take information and return something it can also just do something on its own however a lot of the functions that we're going to see and that are used take in some information and return to us some other information they do some kind of operation with the information past them and then they return to us now a really kind of naive simple example is a function that maybe adds two numbers you pass in the number x y it then adds x and y and returns to the addition of those two numbers now this is not an extremely useful function but that's an example of something a function may do and the point of functions is to make a reusable block of code that does something specific it does one thing very well that again can be used in different parts of the program so let's say you have a very complicated physics equation well you probably don't want to write that out a hundred times every single time you need to perform or evaluate that expression and so what you would do is write a function that can take in all the inputs to that expression or to that equation and then what it can do is solve that for you and return to you the answer and so that is kind of the idea of the functions they separate pieces of logic in our code and they allow us to have reusable blocks of code and so i'm just going to start by creating a function and showing you kind of how they work so i'm going to say int now whenever you define a function the first thing you must do is define the return type of this function so if your function is going to return a value to the caller of this function so i'll make sense in a moment you must define what type that value will be so in this case i'm making a very simple function i'm going to say int this means this function will return an integer value from it and then i'm going to say add and what this function is going to take is two values it's going to take an int which is known as x and it's going to take an int which is known as y so we're using this kind of naive example i described so what i've done is i've declared my function it returns an int it takes in two integers these things here are what is known as the parameters of a function these are the things that must be passed to the function for it to run and then i do my curly braces and now i start the body of the function so what's inside of these curly braces is known as the body of the function and this is where i can do whatever i want and then at the end i can return a value if my function needs to return a value and that value must be the type stated that it will return so in this case i'm going to say return x plus y what this means is that this function will take x value take a y value it will add these two values together and it will return it to whatever column so now if i go in my main function and i say int result equals add 2 3 and then i say c out and i see out my result and we'll just do an endel here in case we do some other stuff after so oops and l and yeah and then we just run this you're going to see that we get 5. so i know i went kind of fast here i'll kind of go through all of this so this is what's known as a function call and the way you call a function is you put the name of the function you put an open parenthesis you put a close closing parenthesis sorry and then inside of the parentheses you put the arguments to the function so this is what is known as the arguments so this argument here is two and it corresponds with the parameter x this argument is three it corresponds with the parameter y so i passed in x which is two i passed in y which was three i added these two values together and then what happened is when i called this function it executed all of this code it waited until the return statement and then it returned some value so the value that was returned kind of replaces the call to this function you can imagine that what kind of happens is we go through our program we read the fact that add exists we read the fact that main exists we run the main function we create this variable result we say it's equal to add 2 3 that means we then go to add we pass in 2 for x we pass in 3 for y we add these values which is 5. we return it we come here and we say well you called this function it returned a value so now this is equal to 5 result is equal to the return value of that function and then we printed out 5. so hopefully that gave you kind of the run through of how a function operates this is the most basic example i can give you as a function now of course functions do not need to take in values i can have a function here it says int say get number and actually we could do yeah we'll just get get number that's fine and then what this can do is just return some number six and now what i can do is say result is equal to get number i do need to call this function still even though it doesn't take in any values when i add these parentheses what this is saying is call this function tell this function to run and now if i look at my result i get 6. i didn't need to pass any values but i still could return a value in this case i returned 6. now let's see what happens if i decide to return 5 after i return 6. well what happens is nothing this 5 does nothing as soon as a return statement is hit in a function that function is immediately done it executes it finishes and it goes back to whatever cult now the great thing about functions so is that we can use them many many times and so that is why you would create a function so what i'm going to do now is see out not result but i'm going to see out and get number right i'm just reusing this function and then i'm going to see out get number a bunch of times and now you're going to see that this works we just keep reusing this function multiple times now get number is not the best example of why we would reuse a function but add kind of gives us a decent example let's say add you know 2 5 and then i copy this and i print it a few times and i change you know four to seven now i can go to six then go to 9 this can be negative 2 this can be negative 8. okay let's get rid of that and let's run this now we get all of our results right we can reuse the function many times now of course in these kind of simple naive examples it's like well why would we do that why wouldn't we just add these values well because you can have functions to do things much more advanced than what i'm showing you here okay so that is kind of the simple explanation of functions now you can have a function that doesn't return something and this is the next example that i will show you so in this case both of these functions were turned in it and since i said they were going to return an int they must finish by returning an int no matter what happens in this function they must return an integer they do not return integer we will get an error and i think i can actually probably show this to you if i run this right now and i have int and there's no return statement in here we're going to get an issue it says warning no return statement in function returning non-void so that was a warning not necessarily a actually i think that's an area because it was highlighting in red but regardless it's telling me hey you didn't return an end that's a problem because you said you're going to return it so now if i return 0 and i run this all is good we don't get that warning so just keep that in mind all right i'm going to erase these i'm going to show you now how we make a function that is defined as what's known as void now a void function simply means it does not return a value so i can say void and then i can say like test and then here what i can do in this function is whatever i want and i do not need to return anything so when i say void let's just maybe go through a for loop here we can say 4 and i equals 0 i less than 10 i plus plus and then maybe what we do here is we see out and we just see out i then we end l so now i can call this function if i call test we can see oh i need a semicolon sorry let's have the semicolon then we just run this function right we just print zero two nine no problem we don't need a return statement what happens if we add a return statement let's return 0 and see what we get notice that we get an error because it says return statement with a value when this function was defined as void so again this is why it's very important important story that you understand the types of your functions what they return what they're taking it as parameters and all of that all right so let's call test again let's call it another time right so this is another good example of why you would want to reuse a function it's way better to have a function that say prints the numbers from one to ten that i can use multiple times than to print the numbers to one to ten like three times so if i were to take this for loop and just copy and paste it three times like that works it's going to do the same thing as we have right now but now consider the situation where we want to change the number of times that we're looping so let's say we want to now loop a hundred times instead of 10 times well what i would have to do now is change this 10 in three places if i had copy and pasted this for loop three times so if we did like this right i would then need to change the ten and three places as opposed to when we use a function here now i only need to change it in one place that's again another good reason why you would use a function because it keeps your code more organized and if you ever need to change something it's better to change it in one place than in multiple places but anyways if i run this you're going to see that we get kind of the expected output we go 0 to 9 0 to 9 0 to 9. great so that's an example of a function now let's see if we can do something even better with this function maybe void test we'll instead take print maybe we'll call this print n times and we're going to take in an integer n and we're going to take in a string text now what i'm going to say is instead of i is less than 10 i'm going to say i is less than n and i'm going to see out the text n times so now what happens is i can use this function called print n times we're going to pass in the number five we're going to pass in the uh the string tim okay now i will kind of copy this line and we'll use it again so we'll say print seven and then we'll say is great just you know a true statement here and there we go okay so now let's run this and you see that we get tim tim tim tim tim is greatest greatest great so on and so forth so what i've done now is i've made this function a bit more general so now it takes in some number n that's the number of times we'll print something it takes in some string text and it will print this text n times and notice i named my function in a way such that it describes what it does print n times right it's telling me exactly what it does and now anywhere in my program i can use this function now where it gets very interesting is when we create functions that are used inside of other functions so let's say void print and let's make this just take in some string we'll call it text now what i'm going to do is i'm going to say c out text and l and i'm going to replace this line in my for loop now with this function print and this print is just going to take text now notice how my code all of a sudden is a little bit easier to read than it was before if you're someone who you know maybe doesn't know c plus plus now what you can do is you can kind of read these function names and this gives you a better idea of what's going on right if i come to this main function i can see oh i'm printing n times and then i'm passing 5 and i'm passing 10. again it might still be a little confusing but now inside of this for loop i can see oh i'm printing something right because maybe you don't know what c out means but you know what print means and so this is just another great example of kind of how you can use functions to really separate all of the logic in your code and make it so much easier for someone who doesn't know the code that you're writing to understand what's going on so if i run this now again it works the exact same way that it did before but i've just split my logic up into different functions now you don't want to go too crazy with this you don't want like super short functions you want to sometimes have functions that are maybe a bit larger that are doing different things but the general rule of thumb is that your function should do one thing it should do one thing very well now you can define what that one thing is that one thing can be you know one large thing and it maybe can use other functions to help it do that but just keep that in mind that you don't want your function to be doing a ton of different things it should be doing one thing and one thing very well and if you notice you have a really really massive function maybe you can split that up into some smaller sub functions so that your code's a little bit easier and cleaner to read and this stuff that i'm showing you comes with years and years of practice right this isn't something you pick up immediately but i just want to give you the rationale and reasoning behind using functions so we will continue in one second but i need to quickly thank the sponsor of this video and this series which is algo expert algo expert is the best platform to use when preparing for your software engineering coding interviews they have mock interviews a data structures crash course and over 150 super high quality coding interview questions check them out from the link in the description and use the discount code tech with tim for a discount on the platform so now there's some more things that we can do with functions functions can get pretty complicated and pretty advanced what i'm going to do now is i'm going to show you what's known as default parameters i'm then going to go over pass by reference versus pass by value so i'm going to make a function i'm going to say int i'm going to say math i'm going to say do math okay this is going to take in one value i'm going to say int x and then i'm going to take an into y i'm going to take an int z but i want this last value z to be optional now what that means by optional is that i want it to be able to be passed in but it doesn't have to be past it so if i want that to be the case i can give a default value for this parameter and what that will do is make this now an optional parameter that does not need to be passed to this function so to actually to clarify this let me do something else i'm just going to return x plus y times z and i'm going to do the x plus y and then multiply that by z so what you're going to see now is that if i try to call this function and i don't give any of these parameters we're going to have an issue so if i say do math and i give 3 and 4 so i give an argument for x an argument for y but i don't give an argument for z you're going to see that we get an error it says expected oh sorry that needs a semicolon uh but not note declared here uh what's our problem now okay declared here in to do math return okay so i think oh here it is too few arguments to function it this is the error i was looking for so it's saying hey you don't have enough arguments this function except takes three and you only pass two so i can fix that now by adding another one here right and there we go all is good everything is working but that's kind of the point right is that you need to pass in all of the parameters but sometimes you have a parameter that you want them to be able to pass in but they don't have to pass it so in that situation you make it optional by adding a default value for it so now when i say in z is equal to 1 this means if you do not give me z i'm going to assume that it is 1. and this is the default value for the parameter z and so now if i run this you see that this still works because we implemented that default value and let's see out this just so we can see what this is giving us we get the value 7 right and the whole idea i guess behind what i was thinking when i did this was okay i want to add two numbers together and then i want the option to multiply them by some factor and in this case if you don't give a value it's just going to keep it the same because it's multiplying it by 1. whereas if i do pass a value maybe i pass 2 obviously now it uses that value 2 because it's overriding the default and now it's giving me 14. so that is what is known as an optional parameter and again these are parameters these are arguments your parameters can be different types as you saw you can have as many parameters as you want you can have a combination of optional and required parameters you can have no parameters just depends on the type of function that you're creating and so there you go and then of course the return type can be any type that you would like you can make this return type something crazy right you can make this return type a pair you can say pair ins int and then what you could do is actually make a pair so let's do this let's say function make pair there is actually a function called make underscore pair in c plus so i'm kind of making a pseudo version of this and let's take in two values into x and y and now what i can do is i can return pair int int of x y and now if i c out let's go make pair 2 3 dot first we should see that we get the value 2 right because that's the first value in our pair and if we were to do second then we get second so functions are very very flexible you can do a lot of stuff with them and again this comes with practice but the data type does not need to be something simple like you can do a vector you can do an array you can do a pair you can do really anything that you want so long as you define what it is and you actually return something like that and of course our function does not need to just be one line i can do all kinds of different lines right i can say you know if x is greater than y then maybe i make a pair where i have let's do this here x and then y but otherwise then what i do is i return a pair that has y and then x that's totally valid and just to note here i don't actually need this else statement i can just do this because what happens is that if i hit this first return statement i immediately exit my program so if x is greater than y i return this and that means i'm done i'm finished the program i won't read this line however if x is not greater than y i don't go in here so i don't return so then i just return this so this is a very common practice you'll see when people are writing functions is that they'll kind of omit and else in a lot of situations because they know if you get into the if statement the function will kind of terminate and be done as soon as you get to the return statement in the if statement and so it's kind of unnecessary to write the else afterwards because well you just don't need to handle that logic essentially so hopefully that kind of makes sense but you can have multiple return statements that's what i'm trying to show you here in the function and whatever one you hit first well you're just going to return that and then you're going to be done the function okay so now i'm going to talk about pass by value versus pass by reference now to do this let's make a simple function let's call this um actually it's not going to be instantly void we're going to say void swap we're going to take into x and into y okay what i'm going to do is just say x equals y and y equals x okay that's what this function is going to do and then in the main function i'll say into x equals 2 and y equals 4. and these don't have to match like let's actually make this a b and then i can call swap a b i'm going to c out a and l i'm going to c out b and l and then actually before i do that we're going to see out a and b and then right before i swap i'm going to say c out swapping okay so i just wrote a lot of code there but essentially what i'm doing is i'm printing out a and b before i swap i'm saying okay i'm going to swap it now and then i'm printing out a and b so if you're looking at this right you can see that i have variable a i have variable b when i call this swap function i pass a and what that means is that x becomes whatever the value of a is which in this case is 2. so you can kind of imagine that when i call swap x is equal to 2 and then y is equal to whatever b is which is 4. so then what i do is i say x equals y and so what this is going to give me is x becomes equal to 4 and then i say y is equal to x well now x has changed right and x is equal to 4. so when i say y is equal to x well y is going to be equal to 4 as well and so obviously that's not exactly what we want i need to kind of fix this i'm going to make a variable called temp i'm going to say int temp equals and then this will be x and then what i'm going to do is say y is equal to 10. so the idea behind this is that i'm going to store the value of x in a temporary variable i am then going to assign x to be equal to y because now i've lost whatever x is equal to right if i don't have a temp variable and then i assign y to be equal to temp because now that will be whatever the original value of x was so that would mean y will now change to equal to 2. anyways the whole point of me showing you this is that i'm swapping two variables right i'm swapping their values so the question i have for you is is it going to swap the value of a and b here yes x and y will actually swap here but will it change the value of a and b here now if you remember my pointers and references you should know the answer to this but let's run this and see oops we get a problem because i always forget the damn semicolon okay let's rerun this and notice we get 2 4 swapping 2 4. so the swap did not change the value of a and b now the reason why that happens is that when you pass something like an int data type actually what's known as a primitive data type i'm not really going to completely discuss that but it's what's known as a primitive data type to a function oh sorry this said x equal to y equal four let's remove that that wouldn't change the output by the way but regardless um when you pass a prime of data type to a function as a argument argument meaning like a b like these are the arguments what actually happens is x becomes equal to so the parameter in this function a copy of the argument so kind of what happens here is when i call swap of a b right a is equal to two and b is equal to four when we actually get to swap x will be assigned to a copy of a so a copy of two and y will be assigned to a copy of b so a copy of four so what that means is that the two and the four that i'm swapping here are not the same as the two and the four that are defined here the reason for that again is it's making a copy just like i showed you previously with references when you assign like int a equals b it makes a copy of b it's not actually equal to b however if you do want to actually be able to modify these values what you have to do is pass the reference to these values not uh what do you call it the actual value itself and so what i would do here is i would say ampersand x and ampersand y and now what this is saying is okay i actually want the reference of x and the reference of y so give me a reference to an end and a reference to another end so that way i can actually modify these hits okay sorry for the cut there something was going wrong with my recording software regardless now if we do this swap okay so now if i call swap a and swap b what's going to happen is it's going to get the reference of a and the reference would be i actually don't need to change this function call here i'll show you why in a second but i don't need to change this at all and now when i run this notice that we get 2 4 and then 4 2. we actually did change the value of a and b in this main function from this function here and again just to refresh you if i remove this ampersand so i remove the reference what happens is i get 2 4 and 2 4. and again the reason for that is that when i add these ampersands this is kind of equivalent of me writing int ampersand x is equal to and then a which means make a reference of a or a reference 2a not copy a's value into the uh the variable x so hopefully that makes sense but that is kind of what we just did we passed the reference two values and now these values can be modified uh like their original value inside of this function so that's very common you'll see a lot of functions where you pass references and again the only situation where you want to pass the reference is where you actually want to modify this value that was passed in you don't just want to make a copy of it so hopefully this example cleared up passed by reference now you also can pass pointers right like i can take a pointer here so if i say int ask asterisk x and into asterisk y now though what i need to do is i need to change this to be ampersand x and ampersand b or sorry ampersand a and ampersand b uh the reason for that now is that this is saying i want a pointer so if you want a pointer you need to actually pass a pointer so you need to pass ampersand so if i run this now we do end up getting a problem but it wasn't with our call so i'll discuss why we have a problem the reason we have a problem is that we've taken in two pointers and then we've tried to kind of reassign pointer values but we haven't dereferenced them so what i can do now is say int temp is equal to asterisk x and then i can say x is equal to i can actually say sorry asterisk x is equal to asterisk y and then i can say asterisk y is equal to temp and hopefully this should fix it let's see now we can see that now we get the correct values because i've de-referenced all of these pointers and we did still perform the swap this time using pointers instead of using references so you can kind of do it in any way that you like references make a lot more sense in functions but if you do want to pass a pointer you can't do that so i think i'm going to leave it here there is a ton to go through in this as soon as you get into the world of functions and then object oriented programming there's just a lot more to learn a lot more that you can do and this may be the last video in the series i will warn you unless you guys have some specific stuff that you want to see so if you have more videos in this series that you want to see maybe you want some more examples of functions maybe you want some different data types or object oriented programming which i wasn't planning on covering then do let me know and i will definitely consider it with that said i hope you guys enjoyed this series please do leave your thoughts on it in the comments if you do appreciate this make sure to leave a like of course subscribe to the channel i will see you in another youtube video you
Original Description
Welcome back to another C++ tutorial! In this video, we'll be covering functions. Functions are really important to C++ programming and we'll see why it was important to learn all the stuff that we did.
💻 AlgoExpert is the coding interview prep platform that I used to ace my Microsoft and Shopify interviews. Check it out and get a discount on the platform using the code "techwithtim" https://algoexpert.io/techwithtim
🔍 Playlist: https://youtube.com/playlist?list=PLzMcBGfZo4-lmGC8VW0iu6qfMHjy7gLQ3
⭐️ Timestamps ⭐️
00:00 | Introduction
00:28 | What are Functions?
02:20 | Creating Functions
05:21 | Functions Without Parameters
08:00 | Void Functions
10:07 | Function Examples
13:40 | Default Parameters
16:30 | Weird Function Return Types
18:43 | Pass By Reference
24:21 | Pass By Pointer
◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
💰 Courses & Merch 💰
💻 The Fundamentals of Programming w/ Python: https://tech-with-tim.teachable.com/p/the-fundamentals-of-programming-with-python
👕 Merchandise: https://teespring.com/stores/tech-with-tim-merch-shop
🔗 Social Medias 🔗
📸 Instagram: https://www.instagram.com/tech_with_tim
📱 Twitter: https://twitter.com/TechWithTimm
⭐ Discord: https://discord.gg/twt
📝 LinkedIn: https://www.linkedin.com/in/tim-ruscica-82631b179/
🌎 Website: https://techwithtim.net
📂 GitHub: https://github.com/techwithtim
🔊 Podcast: https://anchor.fm/tech-with-tim
🎬 My YouTube Gear 🎬
🎥 Main Camera (EOS Canon 90D): https://amzn.to/3cY23y9
🎥 Secondary Camera (Panasonic Lumix G7): https://amzn.to/3fl2iEV
📹 Main Lens (EFS 24mm f/2.8): https://amzn.to/2Yuol5r
🕹 Tripod: https://amzn.to/3hpSprv
🎤 Main Microphone (Rode NT1): https://amzn.to/2HrZxXc
🎤 Secondary Microphone (Synco Wireless Lapel System): https://amzn.to/3e07Swl
🎤 Third Microphone (Rode NTG4+): https://amzn.to/3oi0v8Z
☀️ Lights: https://amzn.to/2ApeiXr
⌨ Keyboard (Daskeyboard 4Q): https://amzn.to/2YpN5vm
🖱 Mouse (Logitech MX Master): https://amzn.to/2HsmRDN
📸 Webcam (Logitech 10
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Tech With Tim · Tech With Tim · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
A* Path Finding Algorithm(Visualization)
Tech With Tim
Python Programming Tutorial #1 - Variables and Data Types
Tech With Tim
Python Programming Tutorial #2 - Basic Operators and Input
Tech With Tim
Python Programming Tutorial #3 - Conditions
Tech With Tim
Python Programming Tutorial #4 - IF/ELIF/ELSE
Tech With Tim
Python Programming Tutorial #5 - Chained Conditionals and Nested Statements
Tech With Tim
Python Programming Tutorial #6 - For Loops
Tech With Tim
Python Programming Tutorial #7 - While Loops
Tech With Tim
Python Programming Tutorial #8 - Lists and Tuples
Tech With Tim
Python Programming Tutorial #9 - Iteration by Item (For Loops Continued...)
Tech With Tim
Python Programming Tutorial #10 - String Methods
Tech With Tim
How to Overclock a NVIDIA GPU
Tech With Tim
Python Programming Tutorial #11 - Slice Operator
Tech With Tim
Python Programming Tutorial #12 - Functions
Tech With Tim
Python Programming Tutorial #13 - How to Read a Text File
Tech With Tim
Python Programming Tutorial #14 - Writing to a Text File
Tech With Tim
Python Programming Tutorial #15 - Using .count() and .find()
Tech With Tim
Python Programming Tutorial #16 - Introduction to Modular Programming
Tech With Tim
Python Programming Tutorial #17 - Optional Parameters
Tech With Tim
Python Programming Tutorial #18 - Try and Except (Python Error Handling)
Tech With Tim
Python Programming Tutorial #19 - Global vs Local Variables
Tech With Tim
Python Programming Tutorial #20 - Classes and Objects
Tech With Tim
Cool VBS Script to Prank Your Friends!
Tech With Tim
How to Overclock an AMD GPU
Tech With Tim
Best GPU'S For Mining Ethereum (2018)
Tech With Tim
Recursion and Memoization Tutorial Python
Tech With Tim
Ethereum Mining Rig - Hardware Guide
Tech With Tim
Pygame Tutorial #1 - Basic Movement and Key Presses
Tech With Tim
How to Install Pygame (Windows 8/10)
Tech With Tim
How to Trade Your Cryptocurrency (Bitcoin, Ethereum etc.) For Cash!
Tech With Tim
How to Mine Ethereum 2018 - WORKING (Super-Easy)
Tech With Tim
Microphone Comparison - $10 Mic vs $150 Mic (Blue Yeti USB)
Tech With Tim
Pygame Tutorial #2 - Jumping and Boundaries
Tech With Tim
Pygame Tutorial #3 - Character Animation & Sprites
Tech With Tim
Pygame Tutorial #4 - Optimization & OOP
Tech With Tim
OBS Studio Tutorial - Best OBS Settings
Tech With Tim
Linear Search Algorithm - Python Example and Code
Tech With Tim
Make Any Mic Sound AMAZING! (WITH OBS)
Tech With Tim
Binary Search Algorithm - Python Example & Code
Tech With Tim
Pygame Tutorial #5 - Projectiles
Tech With Tim
Pygame Game - Mini Golf
Tech With Tim
Pygame Tutorial - Projectile Motion (Part 1)
Tech With Tim
Pygame Tutorial - Projectile Motion (Part 2)
Tech With Tim
Pygame Tutorial #6 - Enemies
Tech With Tim
Pygame Tutorial #7 - Collision and Hit Boxes
Tech With Tim
Pygame Tutorial #8 - Scoring and Health Bars
Tech With Tim
Cloud Mining vs. Hardware Mining - 2018
Tech With Tim
How to Install Pygame on Mac OSX (Fast-Simple)
Tech With Tim
Pygame Tutorial #9 - Sound Effects, Music & More Collision
Tech With Tim
Pygame Tutorial #10 - Finishing Touches & Next Steps
Tech With Tim
How to Fade Your Screen in Pygame [CODE IN DESCRIPTION]
Tech With Tim
How to Create a Button in Pygame [CODE IN DESCRIPTION]
Tech With Tim
Pygame Side-Scroller Tutorial #1 - Scrolling Background/Character Movement
Tech With Tim
Pygame Side-Scroller Tutorial #2 - Random Object Generation
Tech With Tim
Pygame Side-Scroller Tutorial #3 - Collision
Tech With Tim
Pygame Side-Scroller Tutorial #4 - Scoring and End Screen
Tech With Tim
How to Create A Message Box in Python - Tkinter
Tech With Tim
Is Ethereum Mining Still Profitable - Is It Worth It (April 2018)
Tech With Tim
How to Run MAC OSX on a WINDOWS PC (Clover Boot-loader)
Tech With Tim
Programming Problem #1 - Alphabet Soup (Beginner/Novice)
Tech With Tim
More on: LLM Foundations
View skill →Related Reads
Chapters (10)
| Introduction
0:28
| What are Functions?
2:20
| Creating Functions
5:21
| Functions Without Parameters
8:00
| Void Functions
10:07
| Function Examples
13:40
| Default Parameters
16:30
| Weird Function Return Types
18:43
| Pass By Reference
24:21
| Pass By Pointer
🎓
Tutor Explanation
DeepCamp AI