Functions

Results 1 to 5 of 5

Thread: Functions

  1. #1
    Conrad Guest

    Default Functions

    What is the syntax for calling a function with three or more parameters?<BR><BR>Thanks.

  2. #2
    Huh??? Guest

    Default RE: Functions

    &#062; What is the syntax for calling a function with three or more parameters?<BR><BR>Same as for 2 parameters:<BR><BR>something = someFunction( arg1, arg2, arg3, arg4, .... )<BR><BR>Applies to both VBScript and JScript (since you didn&#039t say which you were referring to).<BR>

  3. #3
    Conrad Guest

    Default Sub

    My first mistake is that it needed to be a Sub and not a Funtion. The reason I ask is that I get an error:<BR><BR>Microsoft VBScript compilation error &#039 800a0414&#039 <BR><BR>Cannot use parentheses when calling a Sub <BR><BR>/conrad/my_table.asp, line 95 <BR><BR>set_cells (2,2)<BR>---------------^<BR><BR><BR>Thanks.

  4. #4
    Not-so-huh!! Guest

    Default RE: Sub

    Ah! Right!<BR><BR>It&#039s one of the idiotic peculiarities of VBScript.<BR><BR>When you call a Sub, you must leave off the parentheses *OR* use the "CALL" keyword:<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;set_cells 2, 2<BR>or<BR>&nbsp;&nbsp;&nbsp;&nbsp;Call set_cells( 2, 2 )<BR><BR>It&#039s a really stupid convention. What possible difference can it make?<BR><BR>Incidentally, you can&#039t use parens when calling a Sub even when it has only one parameter.<BR><BR>"Huh?" you say, "I&#039ve done it before!"<BR><BR>You just thought you had. Remember, the syntax for any expression *includes* the possibility that the expression is enclosed in parentheses!<BR><BR>So when you do<BR>&nbsp;&nbsp;&nbsp;&nbsp;mySub( somevalue )<BR>VBScript sees that *as if* you had coded<BR>&nbsp;&nbsp;&nbsp;&nbsp;tempExpression = ( somevalue )<BR>&nbsp;&nbsp;&nbsp;&nbsp;mySub tempExpression<BR><BR>It&#039s another reason that I think the calling-subs rule in VBScript is so utterly stupid. They allow the *appearance* of using parens with one argument, so of course it misleads people when they are ready to use two arguments!<BR><BR>Stupid, stupid, stupid language design. Ehhh...what do you expect? It&#039s what happens when a single company, and a single group within a single company, is allowed to control the design of anything, let alone a language.<BR><BR>Bill Wilkinson<BR>


  5. #5
    Conrad Guest

    Default Thank you very much!

    Thank you very much!

Posting Permissions

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