Fortran

Solo disponible en BuenasTareas
  • Páginas : 7 (1520 palabras )
  • Descarga(s) : 6
  • Publicado : 13 de julio de 2010
Leer documento completo
Vista previa del texto
Do...Loop Statement | | Language Reference | |
See Also

Description
Repeats a block of statements while a condition is True or until a condition becomes True.
Syntax
Do [{While | Until} condition]
    [statements]
    [Exit Do]
    [statements]
Loop
Or, you can use this equally valid syntax:
Do
    [statements]
    [Exit Do]
    [statements]
Loop [{While | Until} condition]The Do...Loop statement syntax has these parts:
Part | Description |
condition | Numeric or string expression that is True or False. If condition is Null, condition is treated as False. |
statements | One or more statements that are repeated while or until condition is True. |
Remarks
The Exit Do can only be used within a Do...Loop control structure to provide an alternate way to exit aDo...Loop. Any number of Exit Do statements may be placed anywhere in the Do...Loop. Often used with the evaluation of some condition (for example, If...Then), Exit Do transfers control to the statement immediately following the Loop.
When used within nested Do...Loop statements, Exit Do transfers control to the loop that is one nested level above the loop where it occurs.

While...WendStatement | | Language Reference | |
See Also

Description
Executes a series of statements as long as a given condition is True.
Syntax
While condition
    [statements]
Wend
The While...Wend statement syntax has these parts:
Part | Description |
condition | Numeric or string expression that evaluates to True or False. If condition is Null, condition is treated as False. |statements | One or more statements executed while condition is True. |
Remarks
If condition is True, all statements in statements are executed until the Wend statement is encountered. Control then returns to the While statement and condition is again checked. If condition is still True, the process is repeated. If it is not True, execution resumes with the statement following the Wend statement.While...Wend loops can be nested to any level. Each Wend matches the most recent While.
|
Tip  The Do...Loop statement provides a more structured and flexible way to perform looping. | |

Controlling Program Flow in VBScript | | Using VBScript |
| Previous | Next | |
 

Controlling Program Execution
Using conditional statements and looping statements (also known as control structures),you can write VBScript code that makes decisions and repeats actions.
Making Decisions Using If...Then...Else
The If...Then...Else statement is used to evaluate whether a condition is True or False and then to specify one or more statements to run, depending on the result. Usually, the condition is an expression that uses a comparison operator to compare one value or variable with another. Forinformation about comparison operators, see Comparison Operators. If...Then...Else statements can be nested to as many levels as you need.
Running Statements if a Condition is True
If you want to run only one statement when a condition is True, you can use the single-line syntax of the If...Then...Else statement. The following example shows the single-line syntax; notice that this example omitsthe Else keyword.

Sub FixDate()
Dim myDate
myDate = #2/13/95#
If myDate < Now Then myDate = Now
End Sub

If you want to run more than one line of code, you must use the multiple-line syntax. This syntax includes the End If statement, as shown in the followingexample:

Sub AlertUser(value)
If value = 0 Then
AlertLabel.ForeColor = vbRed
AlertLabel.Font.Bold = True
AlertLabel.Font.Italic = True
End If
End Sub

Running Certain Statements if a Condition is True,...
tracking img