SPONSORS:






User Tag List

Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Jul 2001
    Location
    Brookline,NH USA
    Posts
    147
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I can\'t nest two \'while\' statements...

    I can't understand why this isn't working... As soon as the 'while' statement on the inside stops satisifying its conditional statement, control should return to the outside 'while' statement, but it never does...

    [-] while (FileReadValue (hFile1, sInitial)) // Read tester initials one at a time
    [ ]
    [-] while (FileReadValue (hFile2, uUser)) // Create all users for each intial
    [ ]
    [ ] uUser.sLastName = sInitial + "-" + uUser.sLastName
    [ ] uUser.sFirstName = sInitial + "-" + uUser.sFirstName
    [ ] uUser.sMiddleName = sInitial + "-" + uUser.sMiddleName
    [ ] uUser.sLogonID = sInitial + "-" + uUser.sLogonID
    [ ] uUser.sIDNum = sInitial + "-" + uUser.sIDNum
    [ ]
    [ ] ListAppend (luNewUsers, uUser)
    [ ]
    [ ] Sleep (0.001)
    [ ]
    [ ] FileClose (hFile1)
    [ ] FileClose (hFile2)
    [ ]
    [ ] // AddMultipleUsers (luNewUsers)
    [-] for each uUser in luNewUsers
    [ ] Print (uUser)

    I'm trying to read from two files and create the same batch of users for several testers.

    Any ideas?

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

  2. #2
    Senior Member
    Join Date
    Jul 2001
    Location
    Brookline,NH USA
    Posts
    147
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: I can\'t nest two \'while\' statements...

    Not sure why the formatting is off in my post, but I found the problem with a little more debugging...

    It seems that once the second file was read to eof, when the first 'while' statement took control again for the next initial the second 'while' condition was no longer met. So my fix was simply to move the FileOpen and FileClose statements for the second file to inside the control of the first 'while' statement...

    ~ Fred

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

  3. #3
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: I can\'t nest two \'while\' statements...

    Same problem here, it's strange but you can do the same with the for loop.

    for(i=1;FileReadValue(hFile1, sInitial);i++)
    for(i=1;FileReadValue(hFile2, uUser);i++)


    This works the same as the while loop You can change the second i to a j in the second loop if you are not confortable with it


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

 

 

Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin 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 03:50 PM.

Copyright BetaSoft Inc.