Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -1 +1,3 @@
{{Control Structures}}This page lists the conditional structures offered by different programming languages. Common conditional structures are '''if-then-else''' and '''switch'''.
{{Control Structures}} [[Category:Simple]]
This page lists the conditional structures offered by different programming languages.
Common conditional structures are '''if-then-else''' and '''switch'''.

View file

@ -0,0 +1,48 @@
* Unconditional Branch or No Branch:
B label Unconditional
BR Rx "
NOP label No Operation
NOPR Rx "
* After Compare Instructions
BH label Branch on High
BHR Rx "
BL label Branch on Low
BLR Rx "
BE label Branch on Equal
BER Rx "
BNH label Branch on Not High
BNHR Rx "
BNL label Branch on Not Low
BNLR Rx "
BNE label Branch on Not Equal
BNER Rx "
* After Arithmetic Instructions:
BP label Branch on Plus
BPR Rx "
BM label Branch on Minus
BMR Rx "
BZ label Branch on Zero
BZR Rx "
BO label Branch on Overflow
BOR Rx "
BNP label Branch on Not Plus
BNPR Rx "
BNM label Branch on Not Minus
BNMR Rx "
BNZ label Branch on Not Zero
BNZR Rx "
BNO label Branch on No Overflow
BNOR Rx "
* After Test Under Mask Instructions:
BO label Branch if Ones
BOR Rx "
BM label Branch if Mixed
BMR Rx "
BZ label Branch if Zero
BZR Rx "
BNO label Branch if Not Ones
BNOR Rx "
BNM label Branch if Not Mixed
BNMR Rx "
BNZ label Branch if Not Zero
BNZR Rx "

View file

@ -1 +1,5 @@
i=(i<0? 0: 42)
if(i<0) {
i=0; j=1
} else {
i=42; j=2
}

View file

@ -0,0 +1 @@
i=(i<0? 0: 42)

View file

@ -0,0 +1 @@
"foo" "bar" 3 4 > sel <<

View file

@ -0,0 +1,5 @@
{3 4 >}
{"foo"}
{"bar"}
ifte
<<

View file

@ -0,0 +1,6 @@
({3 4 >} {"Three is greater than four" }
{3 3 >} {"Three is greater than three"}
{3 2 >} {"Three is greater than two" }
{3 1 >} {"Three is greater than one" })
cond
<<

View file

@ -0,0 +1,14 @@
IF [NOT] ERRORLEVEL number command
IF [NOT] string1==string2 command
IF [NOT] EXIST filename command
IF CMDEXTVERSION number command
IF DEFINED variable command
IF [/I] string1 compare-op string2 command
where compare-op is:
EQU - equal
NEQ - not equal
LSS - less than
LEQ - less than or equal
GTR - greater than
GEQ - greater than or equal
/I case insensitive string compares

View file

@ -0,0 +1,5 @@
IF EXIST %filename% (
del %filename%
) ELSE (
echo %filename% not found
)

View file

@ -1,7 +1,7 @@
a = 3
if( a == 1 ){
io.writeln( 'a == 1' )
}elif( a== 3 ){
}else if( a== 3 ){
io.writeln( 'a == 3' )
}else{
io.writeln( 'a is neither 1 nor 3' )

View file

@ -2,6 +2,6 @@ a = 3
switch( a ){
case 0: io.writeln( 'case 0' )
case 1, 2: io.writeln( 'case 1,2' )
case 3 ... 5: io.writeln( 'case 3...5' )
case 3, 4, 5: io.writeln( 'case 3,4,5' )
default: io.writeln( 'default' )
}

View file

@ -1,14 +1,14 @@
if condition then
statement;
else
statement;
if condition_exp then unique_statement; else unique_statement;
if condition then
do;
statement-1;
.
.
statement-n;
end;
if condition_exp then
unique_statement;
else
statement;
unique_statement;
if condition_exp
then do;
list_of_statements;
end;
else do;
list_of_statements;
end;

View file

@ -1,16 +1,21 @@
select (i); /* select on value of variable */
when (1,4,9)
do;
statement(s)
end;
if condition_exp1 then
statement_1;
else if condition_exp2 then
statement_2;
else if condition_expN then
statement_N;
else
statement_E;
when (11, 42)
do;
statement(s)
end;
other /* everything else */
do;
statement(s)
end;
if condition_exp1 then do;
list_of_statements;
end;
else if condition_exp2 then do;
list_of_statements;
end;
else if condition_expN then do;
list_of_statements;
end;
else do;
list_of_statements;
end;

View file

@ -1,21 +1,16 @@
select; /* select first matching condition */
when (i = 4);
select (i); /* select on value of variable */
when (1,4,9)
do;
statement(s)
statement_s;
end;
when (this = that)
when (11, 42)
do;
statement(s)
statement_s;
end;
when (string = 'ABCDE')
other /* everything else */
do;
statement(s)
end;
other
do;
statement(s)
statement_s;
end;
end;

View file

@ -0,0 +1,21 @@
select; /* select first matching condition */
when (i = 4)
do;
statement_s;
end;
when (this = that)
do;
statement_s;
end;
when (mystring = 'ABCDE')
do;
statement_s;
end;
other
do;
statement_s;
end;
end;

View file

@ -6,18 +6,18 @@ ELSE
IF condition1 THEN
BEGIN
procedure1;
procedure2;
procedure2
END
ELSE
procedure3;
IF condition 1 THEN
IF condition1 THEN
BEGIN
procedure1;
procedure2;
procedure2
END
ELSE
BEGIN
procedure3;
procedure4;
procedure4
END;

View file

@ -1,22 +1,18 @@
if y then x=6 /* Y must be either 0 or 1 */
if y then @=6 /* Y must be either 0 or 1 */
if t**2>u then x=y /*simple IF with THEN & ELSE. */
else x=-y
if t**2>u then x= y
else x=-y
if t**2>u then do j=1 for 10; say prime(j); end /*THEN DO loop.*/
else x=-y /*simple ELSE. */
if z>w+4 then do /*THEN DO group.*/
z=abs(z)
say 'z='z
end
else do; z=0; say 'failed.'; end /*ELSE DO group.*/
if t**2>u then do j=1 to 10; say prime(j); end
else x=-y
if z>w+4 then do
z=abs(z)
say 'z='z
end
else do; z=0; say 'failed.'; end
if x>y & c*d<sqrt(pz) |,
substr(abc,4,1)=='@' then if z=0 then call punt
else nop
else if z<0 then z=-y
if x>y & c*d<sqrt(pz) |, /*this statement is continued [,]*/
substr(abc,4,1)=='~' then if z=0 then call punt
else nop /*NOP pairs up IF*/
else if z<0 then z=-y /*alignment helps*/

View file

@ -1,13 +1,24 @@
/*the WHEN conditional operators are the same as */
/*the IF conditional operators. */
select
when t<0 then z=abs(u)
when t=0 & y=0 then z=0
when t>0 then do
/*the WHEN conditional operators are the same as*/
/*the IF conditional operators. */
select
when t<0 then z=abs(u)
when t=0 & y=0 then z=0
when t>0 then do
y=sqrt(z)
z=u**2
end
/*if control reaches this point and none of the WHENs */
/*were satisfied, a SYNTAX condition is raised (error).*/
end /*select*/
/*if control reaches here & none of the WHENs were*/
/*satisfiied, a SYNTAX (error) condition is raised*/
end /*1st select*/
select
when a=='angel' then many='host'
when a=='ass' | a=='donkey' then many='pace'
when a=='crocodile' then many='bask'
when a=='crow' then many='murder'
when a=='lark' then many='ascension'
when a=='quail' then many='bevy'
when a=='wolf' then many='pack'
otherwise many='?'
end /*2nd select*/ /* [↑] uses OTHERWISE as a catch-all.*/

View file

@ -8,7 +8,7 @@
when g=='wolf' then many='pack'
otherwise say
say '*** error! ***'
say g "isn't one of the known thingys."
say g "isn't one of the known thingys."
say
exit 13
end /*select*/

View file

@ -0,0 +1,11 @@
if (n == 12) "twelve" else "not twelve"
today match {
case Monday =>
Compute_Starting_Balance;
case Friday =>
Compute_Ending_Balance;
case Tuesday =>
Accumulate_Sales
case _ => {}
}

View file

@ -1,2 +1 @@
no
#<unspecified>
(cond <clause1> <clause2> ...)

View file

@ -1 +1,9 @@
(cond <clause1> <clause2> ...)
(display
(cond ((> 1 2) "greater")
((< 1 2) "less")))
(newline)
(display
(cond ((> 1 1) "greater")
((< 1 1) "less")
(else "equal")))
(newline)

View file

@ -1,9 +1 @@
(display
(cond ((> 1 2) "greater")
((< 1 2) "less")))
(newline)
(display
(cond ((> 1 1) "greater")
((< 1 1) "less")
(else "equal")))
(newline)
(case <key> <clause1> <clause2> ...)

View file

@ -1,2 +1,11 @@
less
equal
(display
(case (* 2 3)
((2 3 5 7) "prime")
((1 4 6 8 9) "composite")))
(newline)
(display
(case (car (list c d))
((a e i o u) "vowel")
((w y) "semivowel")
(else "consonant")))
(newline)

View file

@ -0,0 +1,2 @@
If condition
statement

View file

@ -0,0 +1 @@
If condition : statement

View file

@ -0,0 +1,4 @@
If condition
Then
statements
End

View file

@ -0,0 +1,6 @@
If condition
Then
statements
Else
statements
End

View file

@ -0,0 +1,14 @@
If condition1 Then
statement
End If
If condition1 Then
statement
ElseIf condition2 Then
statement
...
ElseIf conditionN Then
statement
Else
statement
End If

View file

@ -0,0 +1,3 @@
If condition Then statement
If condition Then statement Else statement

View file

@ -0,0 +1,19 @@
Select Case Expression
Case Value1: statement
Case Value2: statement
...
Case ValueN: statement
Case Else: statement
End Select
Select Case Expression
Case Value1
statements
Case Value2
statements
...
Case ValueN
statements
Case Else
statements
End Select

View file

@ -1,5 +0,0 @@
if (condition) then
result = "met"
else
Result = "not met"
end if