0

Is there a way to add results in a for loop, while retaining the previous result so I can verify the entire list as items are added?

var listArray = new Array();
listArray[0] = item1 = "100??";
listArray[1] = item2 = "20*0*";
listArray[2] = item3 = "x26*s";

for(i = 0; i < listArray.length; i++)
{        
    _M.Btn(_filter, "Add").ClickButton();

    Log.Message(item[i]);
}

As the loop continues, I want the Log.Message to add each array item, while retaining the previous array item:

Log.Message(item[i] + "," + item[i] + "," + item[i]);
2
  • use another variable to store previous item. Commented Jan 23, 2018 at 18:29
  • use another variable to store previous item. Commented Jan 23, 2018 at 18:31

1 Answer 1

1
    var listArray = new Array();
    listArray[0] = item1 = "100??";
    listArray[1] = item2 = "20*0*";
    listArray[2] = item3 = "x26*s";



    var Msg = "";
    for(i = 0; i < listArray.length; i++)
    {        
        _M.Btn(_filter, "Add").ClickButton();
       if (i == 0) { Msg = item[i];}
       else { Msg = aqString.Concat(Msg, item[i]);}

        Log.Message(Msg);
    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.