# Thread: calling function using Call keyword n without Call

1. ## calling function using Call keyword n without Call

Hi all,

What is the difference between calling the function using 'Call' keyward and withou 'Call' keyward?

Example:
Call calculation(a,b)
and
calculation(a,b)

Thanks,
Sudheer.k

2. ## Re: difference between Call function Name and func

Your 2nd call won't work and 1st would when you use these brackets a return value is expected. If you are not taking the value out then you need to ignore the same for which you use call. If you don't want to worry about return value at all you can use below

calculation a, b

Thank You.

4. ## Re: difference between Call function Name and func

Tarun,
I have got a doubt!!!

Do you mean to say that I can use Calculation(a,b) only if I assign the output of the function to some variable like
"C = Calculation(a,b)"

If I have to call the function and if I am not storing the return value, then I should
"Call Calculation(a,b)"

Is my understanding correct?

5. ## Re: difference between Call function Name and func

Yes you are correct. But when you have only one parameter then all 4 of the below will be valid

x = func(a)

Call func (a)

func a

func (a)

But if you more than one parameter then only below 3 will be valid

x = func(a,b)

Call func (a,b)

func a,b

But func (a,b) will not be valid. Now coming back as to why this happens is because when you use below

func (a)

() is also use to pass a parameter by value (even if the function takes it by ref. So in "func (a)" (a) converts to a's value and then it is passed to the function. The difference of byRef and ByVal can be understood using below example

function func(ByRef a)
a = a + 10
func = a
End function

a = 20

func a

'will display 30 as the function changed value of byref param
Msgbox a

a = 20

func (a)

'will display 20 as the (a) convert it to 20 before passing and hence no impact of byref
msgbox a

6. ## Re: difference between Call function Name and func

The only difference is that "Call calculation(a,b)" is the old style in Visual Basic and VBScript.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 08:45 AM.