SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 5 of 5
  1. #1
    SQA Council
    Join Date
    Mar 2001
    Posts
    8,591
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Function question

    User Teresa Brings (teresa.brings@dig.com) posted:

    ------_=_NextPart_001_01C120F3.CF05F360
    Content-Type: text/plain

    In a user-defined function for example:
    public function enter_info(info_type, out x)

    {

    }

    I just adjusted the code to allow the out x. I have already scripted using
    this function. What will happen to those functions if they call the
    function and don't have the x as a parameter? Those don't need that info
    but from now on I will need that x value. Do I need to go back and rewrite
    how the previous calls are written from enter_info("paper"); to
    enter_info("paper", x); or will they still function properly?

    Mainly checking so this doesn't cause issues later.

    Thanks,

    Teresa






    ------_=_NextPart_001_01C120F3.CF05F360
    Content-Type: text/html; charset=US-ASCII
    Content-Transfer-Encoding: 7bit

    < !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">


    <META content="MSHTML 5.00.3103.1000" name=GENERATOR></HEAD>
    have already scripted using this function. What will happen to those
    functions if they call the function and don't have the x as a parameter?
    Those don't need that info but from now on I will need that x value. Do I
    need to go back and rewrite how the previous calls are written from
    enter_info("paper"); to enter_info("paper", x); or will they still function
    checking so this doesn't cause issues later.</SPAN></FONT></P>

    IMPORTANT EMAIL ADDRESSES:

    Post message: winrunner@yahoogroups.com

    Subscribe: winrunner-subscribe@yahoogroups.com

    Unsubscribe: winrunner-unsubscribe@yahoogroups.com

    ***To unsubscribe via email: From your email program, send a blank message to winrunner-unsubscribe@yahoogroups.com.

    *To reply to the entire list, use the Reply button in your email program

    *To respond offline to an individual, locate the sender's email address in the email message

    *To view archives go to groups.yahoo.com

    Direct any questions, comments, or issues about this list to...

    Eric Marx

    http://www.longhead.com

    dynamic web site development &amp; hosting

    ------_=_NextPart_001_01C120F3.CF05F360--


  2. #2
    Senior Member
    Join Date
    Jul 2001
    Posts
    287
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Function question

    you can distinguish these cases in the function:
    public function enter_info(info_type, out x)
    {
    if (nargs() == 2)
    {
    #...
    }
    else if (nargs() == 1)
    {
    #...
    }
    else
    {
    return(report_param_msg());
    }
    }


    ------------------

  3. #3
    SQA Council
    Join Date
    Mar 2001
    Posts
    8,591
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Function question

    User Deshpande, Laxmikant (ldeshpan@mil.emc.com) posted:

    Hi,

    Just out of curiosity.."nargs()" is a standard function to check the number
    of arguments which are being passed?.

    Please let me know.

    Thanks,


  4. #4
    Senior Member
    Join Date
    Jul 2001
    Posts
    287
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Function question

    From the TSL online reference:
    returns the number of arguments passed.




    ------------------

  5. #5
    Member
    Join Date
    Jun 2001
    Location
    Plano, TX
    Posts
    31
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Function question

    While you might find that it works, it might not be a good habit to get into. I would suggest you go back in scripts that call this item and add a "" or something like that for x. Thi will make your code more readable for the next person who might need to work on it.

    Just a thought

    Greg

    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin 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 07:46 PM.

Copyright BetaSoft Inc.