So this is veeeery easy it’s about creating functions and then calling them on a code for this we’re going to have to start by defining that a function can be called however you want and it can contain a lot of specifications.
Here’s an example of a function called sum which adds two given values by the user. Pay attention and check that you declare what kind of function is, in this case x and y are integer values.
After creating your function int (Which stands for only integer values) in order to call it and execute you’ll need to create your main function where the whole code takes its place.As you can see immediately after creating the main function you must declare the variables you’ll use (x and y) and ask them to the user.
Then when both values are given you must call the function you’d like to execute by it’s name in this case sum (x,y) also specifying the values you’ll use. And that’s it, you’ve just created and called a function.
Masteries 11 and 12 by Luis Daniel García is licensed under a Creative Commons Attribution 4.0 International License.