You've learned how to create functions that take parameters and return values. Now let's practice building and using these complete functions in various scenarios.
Engagement Message
Ready to create some useful functions?
Type
Fill In The Blanks
Markdown With Blanks
Complete this function that calculates the perimeter of a rectangle:
Suggested Answers
- float64
- return
- calculatePerimeter
- func
Type
Multiple Choice
Practice Question
What does this function return when called with getDiscount(120.0, 0.15)
?
A. 120.0 B. 0.15 C. 18.0 D. 135.0
Suggested Answers
- A
- B
- C - Correct
- D
Type
Sort Into Boxes
Practice Question
Sort these function calls based on whether they correctly use the returned value or ignore it.
Function: func multiply(x int, y int) int
Labels
