Revision history for KeyPgIfthen


Revision [21601]

Last edited on 2016-10-25 10:28:52 by fxm [If...Goto, as shortcut for If...Then Goto, exists but is deprecated]
Additions:
**Note:** The single-line syntax ##**If...Goto**##, as shortcut for ##**If...Then Goto**##, is deprecated and it only exists for compatibility with QB.
Deletions:
**Note:** For compatibility with older Basic languages (including QB), the single-line syntax ##**If...Then Goto**## can be shortened into ##**If...Goto**##.


Revision [21600]

Edited on 2016-10-22 04:13:14 by fxm ['If...Then Goto' can be shortened into 'If...Goto']
Additions:
**Note:** For compatibility with older Basic languages (including QB), the single-line syntax ##**If...Then Goto**## can be shortened into ##**If...Goto**##.


Revision [21439]

Edited on 2016-04-30 07:47:23 by fxm [Updated example]
Additions:
Loop 'Go back to the start of the loop
Sleep
Deletions:
loop 'Go back to the start of the loop


Revision [21438]

Edited on 2016-04-30 07:31:31 by fxm [Updated example]
Additions:
Print "guess the number between 1 and 10 (or CTRL-C to abort)"
Deletions:
Print "guess the number between 1 and 10"


Revision [21436]

Edited on 2016-04-30 04:33:41 by fxm [EndIf (without blank) is also supported]
Additions:
Remark: ##**""EndIf""**## (without blank) is also supported like in QB for backward compatibility.


Revision [21427]

Edited on 2016-04-29 08:32:52 by fxm [Complemented description]
Additions:
##**If...Then**## is a way to make decisions.
It is a mechanism to execute code only if a condition is true, and can provide alternative code to execute based on more conditions:
The multi-line syntax allows several ##**Elseifs**## (but none after a ##**Else**##) and tests can be nested (there must be in this case as many ##**End Ifs**## as ##**Ifs**##).
Else 'The user guessed the right number!
Deletions:
##**If...Then**## is a way to make decisions. It is a mechanism to execute code only if a condition is true, and can provide alternative code to execute based on more conditions:
The multi-line syntax allows several ##**Elseifs**## (but none after a ##**Else**##) and tests can be nested (there must be in this case as many ##**End Ifs**## as ##**(else)Ifs**##).
ElseIf guess = num Then 'The user guessed the right number!


Revision [21426]

Edited on 2016-04-29 03:57:08 by fxm [Complemented description]
Additions:
##**If...Then**## is a way to make decisions. It is a mechanism to execute code only if a condition is true, and can provide alternative code to execute based on more conditions:
- Execute code (just behind ##**Then**##) if a condition is true.
- Execute certain code (just behind ##**Then**##) if a condition is true and execute other (just behind ##**Else**##) if it's false.
- Test other conditions (with ##**Elseif**##) if the first condition is false.
Deletions:
##**If...Then**## is a way to make decisions. It is a mechanism to execute code only if a condition is true, and can provide alternative code to execute based on more conditions.


Revision [21425]

Edited on 2016-04-29 03:08:29 by fxm [Complemented description]
Additions:
The multi-line syntax allows several ##**Elseifs**## (but none after a ##**Else**##) and tests can be nested (there must be in this case as many ##**End Ifs**## as ##**(else)Ifs**##).
- If none are true, the code following the ##**Else**## (if exists) is executed alone.
Deletions:
The multi-line syntax allows several ##**Elseifs**## and tests can be nested (there must be in this case as many ##**End Ifs**## as ##**(else)Ifs**##).
- If none are true, the code following the ##**Else**## is executed alone.


Revision [21424]

Edited on 2016-04-29 01:18:32 by fxm [Complemented description]
Additions:
The multi-line syntax allows several ##**Elseifs**## and tests can be nested (there must be in this case as many ##**End Ifs**## as ##**(else)Ifs**##).
If the condition of the ##**If**## is not true, those of ##**Elseifs**## blocks are tested in succession:
- If either of these is true, the corresponding code is executed, then the program skips the following blocks to continue after the ##**End If**##.
- If none are true, the code following the ##**Else**## is executed alone.


Revision [21423]

Edited on 2016-04-29 00:20:45 by fxm [Added link to ElseIf]
Additions:
- ##[[KeyPgElseif|Elseif]]##


Revision [20940]

Edited on 2016-03-13 01:59:50 by fxm [Formatting]

No Differences

Revision [20263]

Edited on 2016-02-10 16:01:10 by DkLwikki [Update link format]
Additions:
##x >= 5 [[KeyPgOpAnd|And]] x <= 10##
##y <> 0 [[KeyPgOpAndAlso|AndAlso]] x \ y = 1##
In the //[[CompilerOptlang|-lang fb]]// and //[[CompilerOptlang|-lang fblite]]// dialects, colons (##:##) can be used instead of newlines to construct multi-line ##**If**## blocks on a single line.

- In the //[[CompilerOptlang|-lang qb]]// and //[[CompilerOptlang|-lang fblite]]// dialects, variables declared inside an ##**If**##..##**Then**## block have a procedure-wide [[ProPgVariableScope|scope]] as in QB
- In the //[[CompilerOptlang|-lang fb]]// and //[[CompilerOptlang|-lang deprecated]]// dialects, variables declared inside an ##**If**##..##**Then**## block are visible only inside the block, and cannot be accessed outside it.
- In the //[[CompilerOptlang|-lang qb]]// dialect, if there is a new line or a single-line comment (##'##) directly after THEN, then the IF will be multi-line. A colon, a ##[[KeyPgRem|Rem]]## or any other statement will result in a single-line IF.
- In the //[[CompilerOptlang|-lang fb]]// and //[[CompilerOptlang|-lang fblite]]// dialects, if there is a new line, a single-line comment (##'##), a colon (##:##), or a ##[[KeyPgRem|Rem]]## statement directly after THEN, then the IF will be multi-line. Any other statement will result in a single-line IF.
- ##[[KeyPgDoloop|Do...Loop]]##
- ##[[KeyPgPpif|#if]]##
- ##[[KeyPgSelectcase|Select Case]]##
Deletions:
##x >= 5 [[KeyPgOpAnd And]] x <= 10##
##y <> 0 [[KeyPgOpAndAlso AndAlso]] x \ y = 1##
In the //[[CompilerOptlang -lang fb]]// and //[[CompilerOptlang -lang fblite]]// dialects, colons (##:##) can be used instead of newlines to construct multi-line ##**If**## blocks on a single line.

- In the //[[CompilerOptlang -lang qb]]// and //[[CompilerOptlang -lang fblite]]// dialects, variables declared inside an ##**If**##..##**Then**## block have a procedure-wide [[ProPgVariableScope scope]] as in QB
- In the //[[CompilerOptlang -lang fb]]// and //[[CompilerOptlang -lang deprecated]]// dialects, variables declared inside an ##**If**##..##**Then**## block are visible only inside the block, and cannot be accessed outside it.
- In the //[[CompilerOptlang -lang qb]]// dialect, if there is a new line or a single-line comment (##'##) directly after THEN, then the IF will be multi-line. A colon, a ##[[KeyPgRem Rem]]## or any other statement will result in a single-line IF.
- In the //[[CompilerOptlang -lang fb]]// and //[[CompilerOptlang -lang fblite]]// dialects, if there is a new line, a single-line comment (##'##), a colon (##:##), or a ##[[KeyPgRem Rem]]## statement directly after THEN, then the IF will be multi-line. Any other statement will result in a single-line IF.
- ##[[KeyPgDoloop Do...Loop]]##
- ##[[KeyPgPpif #if]]##
- ##[[KeyPgSelectcase Select Case]]##


Revision [16295]

Edited on 2012-08-17 10:46:55 by FxMwikki [Visibility of variables declared inside an If..Then block]
Additions:
- In the //[[CompilerOptlang -lang qb]]// and //[[CompilerOptlang -lang fblite]]// dialects, variables declared inside an ##**If**##..##**Then**## block have a procedure-wide [[ProPgVariableScope scope]] as in QB
- In the //[[CompilerOptlang -lang fb]]// and //[[CompilerOptlang -lang deprecated]]// dialects, variables declared inside an ##**If**##..##**Then**## block are visible only inside the block, and cannot be accessed outside it.
- In the //[[CompilerOptlang -lang qb]]// dialect, if there is a new line or a single-line comment (##'##) directly after THEN, then the IF will be multi-line. A colon, a ##[[KeyPgRem Rem]]## or any other statement will result in a single-line IF.
- In the //[[CompilerOptlang -lang fb]]// and //[[CompilerOptlang -lang fblite]]// dialects, if there is a new line, a single-line comment (##'##), a colon (##:##), or a ##[[KeyPgRem Rem]]## statement directly after THEN, then the IF will be multi-line. Any other statement will result in a single-line IF.
Deletions:
In the //[[CompilerOptlang -lang fb]]// and //[[CompilerOptlang -lang fblite]]// dialects, if there is a new line, a single-line comment (##'##), a colon (##:##), or a ##[[KeyPgRem Rem]]## statement directly after THEN, then the IF will be multi-line. Any other statement will result in a single-line IF.
In the //[[CompilerOptlang -lang qb]]// dialect, if there is a new line or a single-line comment (##'##) directly after THEN, then the IF will be multi-line. A colon, a ##[[KeyPgRem Rem]]## or any other statement will result in a single-line IF.


Revision [15216]

Edited on 2011-09-09 09:33:55 by DkLwikki [Fix number guessing example]
Additions:
ElseIf guess > num Then 'The user's guess is too high
ElseIf guess < num Then 'The user's guess is too low
Deletions:
ElseIf guess > num Then 'The user's guess is too low
ElseIf guess < num Then 'The user's guess is too high


Revision [13452]

The oldest known version of this page was created on 2008-06-29 11:24:29 by JeffMarshall [Fix number guessing example]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode