Calling vs invoking a function

后端 未结 5 1693
北恋
北恋 2020-12-24 05:45

Up to this point, I thought \"calling\" and \"invoking\" a function meant the same thing. However, in a YouTube tutorial it said to invoke a function by calling it.

5条回答
  •  既然无缘
    2020-12-24 06:24

    Yes, in most cases we use both to refer the execution of a function.

    There are 2 ways to reach place B from your HOME.

    1. Direct/Automatic way (Invoke), i.e. if you choose first way, you do not need to walk. Someone will automatically take you to place B.
    2. Indirect way (Call), i.e. if choose second way, you only need to reach A(by walk). Someone is there at place A to automatically take you to place B.

    Have a look at the below image. I think it will clear your doubt.

    In case of Calling, you originally refer to the statement that actually calls the function.

    In case of Invoking, you indirectly refer to calling statement to actually invoke/run the function.

提交回复
热议问题