You’ll definitely hear the words parameter and argument during your coding journey. In some cases, you may hear them being used interchangeably, however, they are different but closely related.

Let’s use an example to get a better understanding of parameter and argument.

When you are declaring a function, you will state the parameters required for it to work.

``````def multiply(x, y)
x * y
end

# x and y are the parameters
``````

In the above example, we created a function that has two parameters, x and y. A parameter is what is required to make the function work when it is declared

An argument is what is actually passed to the function when it is being called.

``````multiply(2,3)

# 2 and 3 are the arguments
# output 6
``````

When we use a function and pass in data, then it is called an argument. So we passed two arguments to the multiply function.

I hope this helps clarify the use of these two terms.

This post is also available on DEV.
{"ft_lang_label":"__label__en","ft_lang_prob":0.8428109,"math_prob":0.9322646,"size":887,"snap":"2020-34-2020-40","text_gpt3_token_len":199,"char_repetition_ratio":0.15628539,"word_repetition_ratio":0.0,"special_character_ratio":0.21984217,"punctuation_ratio":0.0989011,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97117245,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-09-18T12:59:38Z\",\"WARC-Record-ID\":\"<urn:uuid:09343b34-ff4e-4f7c-9c16-7463c8238014>\",\"Content-Length\":\"8843\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:24359fe7-678a-4c32-bcaf-c6ac1002fcda>\",\"WARC-Concurrent-To\":\"<urn:uuid:b7314a07-ad82-443d-b2a1-29ef5627288e>\",\"WARC-IP-Address\":\"104.248.63.231\",\"WARC-Target-URI\":\"https://www.aweys.ca/posts/what-are-parameters-and-arguments-1flf/\",\"WARC-Payload-Digest\":\"sha1:ALIFYKNKJDNYZW7IZG4O3UVZZNGVI7F6\",\"WARC-Block-Digest\":\"sha1:GQWMROAU3PE4D3V5TGQV6RCBCX5CJEAS\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-40/CC-MAIN-2020-40_segments_1600400187899.11_warc_CC-MAIN-20200918124116-20200918154116-00337.warc.gz\"}"}