Web hosting india - CHAPTER 7 ITERATIVE PROCESSING Note The ListBox
CHAPTER 7 ITERATIVE PROCESSING Note The ListBox control displays a list of String values from which the user can make a selection. You can add items to a ListBox from the REALbasic IDE by assigning data to its InitialValue property. REALbasic also lets you programmatically add items to a ListBox control using its AddRow method. Because the Do Loop does not specify a predefined condition that must be met for the loop to stop executing, it is up to the programmer to develop a means for stopping loop execution. In the previous example, this occurred when the value of intCounter was set equal to ten, at which time the Exit statement was executed. The Exit statement causes the immediate termination of a loop, allowing your application to continue processing, starting with the first code statement following the loop. Figure 7-1 shows the output produced when this example is executed on a computer running Windows. Figure 7-1. Using a Do Loop to populate a ListBox, as seen on Windows You should avoid using the Do Loop and the Exit statement when creating loops within your REALbasic applications. Because the termination condition is not clearly identified at the beginning or the ending of the loop, the condition that will terminate loop execution is not readily evident. This is generally considered a poor programming practice because it forces you to read through all the code statements contained within the loop to identify how it is terminated. A better way of setting up a Do Loop is to include the optional Until keyword. This enables you to set up loops that execute until a specific condition becomes True or, to put it another way, the Do Loop executes as long as a specified condition remains False. This form of the Do Loop is perfect for situations where you know in advance what condition must be met for the loop to terminate its execution. For example, you might set up a Do Loop to run until a variable was set equal to a certain value or until the user entered a certain command.
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.