SELECT CASE variable CASE value1 Command CASE value2 Command CASE value3 Command END SELECT in Java
SELECT CASE variable CASE value1 Command CASE value2 Command CASE value3 Command END SELECT Generate QR Code ISO/IEC18004 In Java Using Barcode generation for Java Control to generate, create QR image in Java applications. Branching Statements
Generating Barcode In Java Using Barcode drawer for Java Control to generate, create barcode image in Java applications. Book VI 5
Recognize Barcode In Java Using Barcode scanner for Java Control to read, scan read, scan image in Java applications. The preceding SELECT-CASE is equivalent to the following IF-THEN-ELSEIF statement: Denso QR Bar Code Creator In C#.NET Using Barcode creation for .NET Control to generate, create QR Code ISO/IEC18004 image in .NET framework applications. IF variable = value1 THEN Command ELSEIF variable = value2 THEN Command ELSEIF variable = value3 THEN Command END IF Encode QR Code In VS .NET Using Barcode generator for .NET Control to generate, create QR Code JIS X 0510 image in Visual Studio .NET applications. Visual Basic and REALbasic
QR Code 2d Barcode Generator In VB.NET Using Barcode creation for .NET Control to generate, create QR Code 2d barcode image in .NET applications. To check if a variable matches multiple values, you can separate multiple values with commas or use the TO keyword to match a range of values, such as Code 128C Generator In Java Using Barcode creator for Java Control to generate, create ANSI/AIM Code 128 image in Java applications. SELECT CASE variable CASE value1, value2, value3 Command CASE value4 TO value10 Command END SELECT
EAN-13 Maker In Java Using Barcode generation for Java Control to generate, create EAN / UCC - 13 image in Java applications. The preceding SELECT-CASE is equivalent to the following IF-THEN-ELSEIF statement: Generating Barcode In Java Using Barcode generation for Java Control to generate, create bar code image in Java applications. IF variable = value1 OR variable = value2 OR variable = value3 THEN Command ELSEIF variable >= value4 AND variable <= value10 THEN Command END IF Draw GTIN - 12 In Java Using Barcode encoder for Java Control to generate, create UPC-A Supplement 2 image in Java applications. Besides checking for exact values, the SELECT CASE statement can also compare values with the <, <=, >, or >= comparison operators, such as Code 39 Maker In Java Using Barcode generator for Java Control to generate, create Code 3 of 9 image in Java applications. SELECT CASE variable CASE IS >= value1 Command CASE IS < value2 Command END SELECT
Drawing 2/5 Interleaved In Java Using Barcode drawer for Java Control to generate, create Interleaved 2 of 5 image in Java applications. When the SELECT-CASE statement uses comparison operators, it uses the IS keyword The preceding SELECT-CASE statement is equivalent to Make EAN 128 In VB.NET Using Barcode generator for .NET framework Control to generate, create UCC-128 image in Visual Studio .NET applications. IF variable >= value1 THEN Command ELSEIF variable < value2 THEN Command END IF
Decoding USS Code 39 In .NET Framework Using Barcode reader for VS .NET Control to read, scan read, scan image in .NET framework applications. Looping Statements
Bar Code Maker In VS .NET Using Barcode maker for VS .NET Control to generate, create bar code image in VS .NET applications. Looping Statements
Paint Code39 In Visual Basic .NET Using Barcode drawer for .NET Control to generate, create ANSI/AIM Code 39 image in .NET framework applications. A looping statement repeats one or more commands for a fixed number of times or until a certain Boolean condition becomes True To create a loop that repeats for a fixed number of times, use the FOR-NEXT loop, which looks like this: European Article Number 13 Maker In VS .NET Using Barcode encoder for VS .NET Control to generate, create EAN13 image in .NET framework applications. FOR variable = Start TO End Command NEXT
Decode UPCA In .NET Using Barcode decoder for VS .NET Control to read, scan read, scan image in .NET applications. If you wanted the FOR-NEXT loop to run five times, you d set the Start value to 1 and the End value to 5, such as Bar Code Generator In .NET Framework Using Barcode generation for ASP.NET Control to generate, create barcode image in ASP.NET applications. FOR variable = 1 TO 5 Command NEXT
Painting Barcode In VS .NET Using Barcode maker for Visual Studio .NET Control to generate, create bar code image in Visual Studio .NET applications. Normally the FOR-NEXT loop counts by one, but you can use the STEP keyword to make the FOR-NEXT loop count by any value, such as by three, as shown in this example: FOR variable = 1 TO 36 STEP 3 Command NEXT
Rather than count up, the FOR-NEXT loop can also count down In Visual Basic, you can count down by using a negative number after the STEP keywords, such as FOR variable = 100 TO 1 STEP -1 Command NEXT
In REALbasic, you can count down by replacing the TO keyword with the DOWNTO keyword, such as
FOR variable = 100 DOWNTO 1 Command NEXT
If you don t know how many times you need to repeat commands, use a DO loop The two variations of a DO loop are DO-UNTIL and DO-WHILE (available only in Visual Basic) Creating Subprograms and Functions
Book VI 5
The DO-UNTIL loop repeats until a certain condition becomes True The DO-WHILE loop repeats while a certain condition remains True The two variations of the DO-UNTIL loop look like this: DO UNTIL condition Command Loop
Visual Basic and REALbasic
In this version, the DO-UNTIL loop checks if a condition is True If so, this loop never runs If not, this loop runs at least once The second variation of the DO-UNTIL loop looks like this: DO Command Loop UNTIL condition
This loop runs at least once before checking a condition If the condition is True, the loop stops The DO-WHILE loops work nearly identically If you want to make a loop that may run zero or more times, you d use this DOWHILE loop: DO WHILE condition Command Loop
If you want a DO-WHILE loop that runs at least once, you d use this variation: DO Command Loop WHILE condition
Although REALbasic lacks the DO-WHILE loop, it does offer a WHILE-WEND loop, which looks like this: WHILE condition Command WEND
Creating Subprograms and Functions
You can create a subprogram (or a procedure) by using the SUB keyword as follows: SUB Name (Parameter list) Command END SUB
Creating Subprograms and Functions
Every subprogram must have a unique name, which usually describes the purpose of that subprogram, such as Calculate_Velocity or CheckPassword The parameter list declares variables to hold any data the subprogram may need from another part of the program For example, a simple parameter list might look like this: SUB Name (BYVAL Age AS Integer) Command END SUB
The BYVAL keyword stands for By Value and means that the subprogram receives a copy of data sent to it from another part of the program If the subprogram changes the value of that data, the new value of that data only appears in the subprogram and not in any other part of the program The BYVAL keyword is optional in REALbasic Instead of the BYVAL keyword, you could also use the BYREF keyword, which stands for By Reference, such as SUB Name (BYREF Age AS Integer) Command END SUB
When accepting data By Reference, a subprogram can change the value of that data, which can affect the rest of the program A function is a special version of a subprogram that always returns a single value To create a function, use the FUNCTION keyword, such as
|
|
|
|
| ALL RIGHTS RESERVED. Business Refinery (c) 2006 - 2010. | Terms of Use | Privacy Policy |