Click on Back to the Assignment Question Page
Hope you remember the SELECT CASE statement in which we have looked at a code where in the user can perform a particular type of operation like addition, subtraction, multiplication and division. Now using the For loop try to ask the user how many times the operation should perform. For ex if the user enters 3 then the code should run for three times.
This Code gives an idea as to how we can use FOR loop in our script to make it more meaningful and reduce the no of lines of code.
Hope you remember the SELECT CASE statement in which we have looked at a code where in the user can perform a particular type of operation like addition, subtraction, multiplication and division. Now using the For loop try to ask the user how many times the operation should perform. For ex if the user enters 3 then the code should run for three times.
Look the script for this Select Case Statement
The script for this is given below. What i have done is that before the user to select the operation before this line we will add few code like an inputbox and a for loop. The code to be added in the top is like this and at the end of the code add NEXT. Now we are asking the user how many times the user wants to perform the operations and taking that value in the variable Varint1 and converting it into integer. Remember that by default a variant is a string. Then we are passing the value into the for Loop and incrementing by one value.
1 comment:
Hi,
how can we make a infinite loop, meaning like till user wants to perform operation.
Post a Comment