Welcome to the Defining Functions with Parameters Practice Lab. In this module you will be provided with the instructions and devices needed to develop your hands-on skills.
The following exam objective is covered in this lab:
- 2.5 Complete and debug a function that accepts parameters and returns a value
It will take approximately 10 minutes to complete this lab.
Exercise 1 - Creating Functions with Parameters
As you know, user-defined functions can have arguments or parameters. The parameters are placed within the parentheses just after the function name. These are separated by commas. For example, a user-defined function definition with parameters will be as follows:
The data types of parameters need not be specified. The values for parameters num1 and num2 will be passed when the function is invoked.
The function mycalc(num1, num2) can be invoked as follows:
The function will display the output as 100 on execution.
- Task 1 - You will download the Visual Studio Code workspace (Calculator) from the Intranet and create a new HTML page named Functions_param.html in the Calculator workspace.
After completing this exercise, you will be able to:
See the full benefits of our immersive learning experience with interactive courses and guided career paths.