Start learning free

LESSON 36 OF 671 · FUNCTIONS I

Parameters & Arguments: Buggy Code I in Go

Practice

Inside the code editor we've tried to define and call a function that takes a number as an argument and prints double that number to the console.

When the code is fixed, it should print:

20

But the code has a variable-name mistake. In Go, a function parameter can only be used by the name it was declared with.

For example, if the parameter is named n, the function body should use n, not a different name like num.

Assignment:

Your task is to fix the code so no errors are produced and it prints the desired output.


STEP 1 OF 1
    Ctrl + Enter to check