Results 1 to 4 of 4

Thread: Default param

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    California
    Posts
    154

    Default param

    how do you make a default value for a parameter
    VB-World addict!

    All spelling errors are undocumented words!
    http://www.bells.f2s.com

  2. #2
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500
    here is an example:

    Code:
    void function(int x, int y=0)
    {
       //whatever in here
       //if no value is passed for y, it'll be 0 by default..
    }
    Amon Ra
    The Power of Learning.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    California
    Posts
    154
    Thanks
    I wonder what the default keyword is for then?


    If you put your C++ code
    in php
    PHP Code:
    if then "this is a string" 
    tags it highlights the keywords nicely.
    Last edited by Bjwbell; Aug 1st, 2001 at 12:30 AM.
    VB-World addict!

    All spelling errors are undocumented words!
    http://www.bells.f2s.com

  4. #4
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500
    i knoe only one use of the default keyword:

    PHP Code:
    switch(x)
    {
        case 
    1: {}
        case 
    2: {}
        default: {}
    //basically, it does what's in these brackets if none of the cases above are met

    Amon Ra
    The Power of Learning.

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