Dear friends,
Recently i had attend an interview and the interviewer ask me a question,
How will you skip a particular iteration from a loop in vb script without using the If condition checking inside the loop. i have no answer for this question and still searching for it.. is there anyone know..pls share it..
Thanks,
Shibin P
Shibin, Please don't create duplicate threads. We have deleted the other one.
As far as the answer is concerned (unless this is a trick question), one of the methods can be by putting this for loop in a function and making the lower and upper index as variables. So you can have something like
PHP Code:
Function loop_iteration(lower,upper)
...
End Function
'if you wish to skip say nth iteration you can
Call (lower, n-1)
Call (n+1, upper)
Others - please contribute your solutions as well.
Thanks for the reply... i hope this is something like writing a loop for 2 times by avoiding the iteration which is not required.. m not sure whether my interviewer want the same...
thanks again...
Sorry if my reply is so stupid....
if the requirement is not to use 'IF' and 2 for loops...
i will do something like this
Code:
For iterationNo =1 to 100
Select Case iterationNo
Case N ' condition to be skipped
'Skipping
Case Else
' continues
End Select
Next
Dear friend ,
Many thanks for your reply... i m not sure but most probably u may be correct, because may be my interviewer was checking my outbox thinking/analytical skill...
thank you so much...
how to make maximum number and minimum number function in QTP