Results 1 to 3 of 3

Thread: What does 'ByVal" mean in VBSCript

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    13

    Cool

    Hi,
    I have been learning a little ASP and VbScript. However one example in the book i am using refers to 'ByVal' in some code and does not really make any reference to it.

    Below is the sample code. As you can see 'Byval' is inbetween the brackets where the variable declarations go. However nowhere is 'ByVal' referred to as a variable and as I understand it when there is more than one variable there should be a ','.

    Anyway if anyone can explain this to me i would be extremely gratefull.


    public Property Let CurrentSpeed(ByVal iSpeedIn)
    internal_speed = iSpeedIn
    End Property

  2. #2
    Guest
    Originally posted by Iain17
    ByVal
    Passes a copy of the variable to the sub / function. Thus the actual value of the variable is
    placed on the stack. Any modification to the variable are local to this sub and are not
    mirrored on the calling sub.

  3. #3
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140

    ByRef

    The oppisite is ByRef. There you pass the reference to the variable, which means any local change will change the value of the variable in the calling scope.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

Posting Permissions

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



Click Here to Expand Forum to Full Width