CrazyEngineers
  • Difference between parameters and arguments - are they the same?

    Kaustubh Katdare

    Kaustubh Katdare

    @thebigk
    Updated: Oct 26, 2024
    Views: 1.1K
    Many programmers use the terms 'parameters' and 'arguments' interchangeably. Consider the following function -

    function best_function_ever( int $param1, string $param2, bool $default = true ) 
    
    In the above code, $param1, $param2 and $default are 'parameters'; or are they arguments? Most of the people would say there's no difference between them and they are correct. However, at times, you might be required to know the subtle difference between the terms parameters and arguments. So keep this in mind:
    • Parameters: These are the values that your function will accept, as designed.
    • Arguments: These are the actual values that you pass when calling the function.
    An interviewer might just throw this googly at you during a technical interview to test your knowledge.

    If you want more clarification or have doubts, post them below so that we can discuss.
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Home Channels Search Login Register