SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Oct 2002
    Location
    Santa Monica, CA, USA
    Posts
    47
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Dynamic declaration

    Hi,

    is the any way to declare variable dynamically?

    Let's say, I have an array Arr[1] = "MyVar1" and Arr[2] = "MyVar2" and I want to declare MyVar1 and MyVar2 during the code execution.

    Thanks
    Thanks,
    Yuriy

  2. #2
    SQA Knight
    Join Date
    Jun 2002
    Location
    Cupertino, CA, USA
    Posts
    2,164
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Dynamic declaration

    No, because declaration means "please allocate memory for this before execution begins" For example, the following generates a syntax error:

    if (1)
    {
    public MyVar;
    }

    Declarations cannot take place inside an if statement. Fortunately, variables and arrays do not need to be declared in WinRunner, so it becomes a non-issue.

  3. #3
    Member
    Join Date
    Oct 2002
    Location
    Santa Monica, CA, USA
    Posts
    47
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Dynamic declaration

    but it seems to me that this could be an issue. Let's say I I have a call chain and in the last in chain script I created a variable and assigned value to it, then I want to use this variable(with value) in the first in the chain script.

    Do I need to declare this variable as public in the last in chain script and as an extern in the first one?
    Thanks,
    Yuriy

  4. #4
    SQA Knight
    Join Date
    Jun 2002
    Location
    Cupertino, CA, USA
    Posts
    2,164
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Dynamic declaration

    Shouldn't be a problem:

    Sub Test:

    a = 3;


    Main Test:

    call "c:\\subtest"();
    pause(a); #displays 3;

 

 

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 01:49 AM.

Copyright BetaSoft Inc.