|
-
Mar 11th, 2001, 05:57 PM
#1
Thread Starter
Addicted Member
Whats the diffrence between "CALL sub1" and just "sub1"
-
Mar 11th, 2001, 06:01 PM
#2
the only thing I know of is that with Call, you need to pass parameters like :
Call Sub1("Hello")
as with simply saying "Sub1" its just :
Sub1("Hello")
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 11th, 2001, 06:06 PM
#3
There is no differnce. Call is an optional keyword that was once used in the old days of Basic.
-
Mar 11th, 2001, 06:13 PM
#4
call can still b useful sometimes tho with things like msgbox coz u dont have to use a variable when u dont need to know what they clicked
-
Mar 11th, 2001, 06:17 PM
#5
if you don't need to know what they click then just don't use Parentheses.
ex:
MsgBox "This Work Just Fine", vbOKOnly
-
Mar 11th, 2001, 06:23 PM
#6
its good for readability...say you've just inheirited a project from some one and you come across this...
The first thing I would think is what the f*** is this supposed to be? Now if it was a small amount of code, I could look through and see a sub or function called makeBacon, but let's say there's 400 lines of code? Do you what to go looking through the entire app for "makeBacon"? I wouldn't... so if you use:
you know you're dealing with a procedure of some sort...
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 11th, 2001, 06:25 PM
#7
That is a very good point
-
Mar 11th, 2001, 06:31 PM
#8
i didt know u could do msgboxes like that 
!!!!
But anyway, as to the people that say use call for readability, whats wrong with comments?
-
Mar 11th, 2001, 06:31 PM
#9
PowerPoster
I tend to use "call" in all of my projects, for sheer readability.
-
Mar 11th, 2001, 06:33 PM
#10
ok, on comments...
Code:
makeBacon 'this calls the makeBacon subroutine
do you want to have to do this for every occasion that you call makeBacon? it doesn't seem very practical to me...
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 11th, 2001, 06:34 PM
#11
thanks for the support Lethal
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 11th, 2001, 06:55 PM
#12
Fanatic Member
Although readability is a very good point and I use it where possible, I don't think you use call to call a function and return a value. So call can only be used when you call a sub or a function where you are not interested in the result. If you want to return a value from the function you cannot use call.
E.g
Call msgbox("Confirm",vbyesno) 'doesn't return a value
msgbox ("confirm",vbyesno) 'returns a value
-
Mar 11th, 2001, 07:00 PM
#13
PowerPoster
i see what your saying it wouldn't make sense to do this:
Code:
Dim X as Integer
x = Call MsgBox "Blah Blah Blah"
Times like this you make the exception
By the way, no problem Crypt.... , great minds think alike..hehe
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|