Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,37 @@
|
|||
Module CheckIt {
|
||||
Read a
|
||||
If a>1 then {
|
||||
Print "Top"
|
||||
} else.if a>=-4 then {
|
||||
Print "Middle"
|
||||
} else {
|
||||
Print "Bottom"
|
||||
}
|
||||
}
|
||||
CheckIt 100
|
||||
CheckIt 0
|
||||
CheckIt -100
|
||||
|
||||
Module CheckIt {
|
||||
Read a
|
||||
\\ using end if without blocks
|
||||
If a>1 then
|
||||
Print "Top"
|
||||
else.if a>=-4 then
|
||||
Print "Middle"
|
||||
else
|
||||
Print "Bottom"
|
||||
End If
|
||||
}
|
||||
CheckIt 100
|
||||
CheckIt 0
|
||||
CheckIt -100
|
||||
|
||||
Module CheckIt {
|
||||
Read a
|
||||
\\ without use of END IF in one line
|
||||
If a>1 then Print "Top" else.if a>=-4 then Print "Middle" else Print "Bottom"
|
||||
}
|
||||
CheckIt 100
|
||||
CheckIt 0
|
||||
CheckIt -100
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
Module Checkit {
|
||||
Read x
|
||||
Print If(x>100-> 100, x)
|
||||
}
|
||||
Checkit 30
|
||||
Checkit 300
|
||||
|
||||
\\ we can use more than two expressions, if i is not in range then 0 returned
|
||||
Module Checkit {
|
||||
Read i,x
|
||||
Print If(i-> x*5, x*40, x*500)
|
||||
}
|
||||
Checkit 1, 20
|
||||
Checkit 2, 20
|
||||
Checkit 3, 20
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
Module Checkit {
|
||||
def a
|
||||
Print type$(a)="Double"
|
||||
b=(1,2,3,4)
|
||||
for i=1 to 3
|
||||
a=if(a->, b) ' this happen only one time, where a is a double, second time a is an object
|
||||
Print a ' print 3 values
|
||||
a++ ' add 1 to each value
|
||||
Print type$(a)="mArray"
|
||||
Next i
|
||||
}
|
||||
Checkit
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
Module CheckIt {
|
||||
Read a
|
||||
Select Case a
|
||||
Case >1
|
||||
{
|
||||
Print "Top"
|
||||
\\ need block if we have more than one line of code
|
||||
}
|
||||
Case >=-4
|
||||
Print "Middle"
|
||||
Else
|
||||
Print "Bottom"
|
||||
End Select
|
||||
}
|
||||
CheckIt 100
|
||||
CheckIt 0
|
||||
CheckIt -100
|
||||
|
||||
Module CheckIt {
|
||||
Read a
|
||||
if a>-500 then
|
||||
Select Case a
|
||||
Case >1
|
||||
{
|
||||
Print "Top"
|
||||
\\ need block if we have more than one line of code
|
||||
}
|
||||
Case >=-4
|
||||
Print "Middle"
|
||||
Else Case \\ need ELSE CASE if Select Case is inside a IF END IF (WITHOUT BLOCK)
|
||||
Print "Bottom"
|
||||
End Select
|
||||
Else
|
||||
Print "Out of range"
|
||||
End if
|
||||
}
|
||||
CheckIt 100
|
||||
CheckIt 0
|
||||
CheckIt -100
|
||||
CheckIt -500
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
x=10
|
||||
While x>0 {
|
||||
Print x
|
||||
x--
|
||||
}
|
||||
Do { ' se can use Repeat in place of Do
|
||||
x++
|
||||
Print x
|
||||
} Until x=10
|
||||
|
||||
\\ without curly braces:
|
||||
x=10
|
||||
While x>0
|
||||
Print x
|
||||
x--
|
||||
End While
|
||||
Do
|
||||
x++
|
||||
Print x
|
||||
Until x=10
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
Module CheckIt {
|
||||
For i=1 to 10 {
|
||||
x=Random(1,2)
|
||||
{
|
||||
On x Goto alfa, beta
|
||||
alfa:
|
||||
Print "ok1"
|
||||
Exit
|
||||
beta:
|
||||
Print "ok2"
|
||||
Exit
|
||||
}
|
||||
Print "End One"
|
||||
|
||||
x=Random(1,2)
|
||||
{
|
||||
On x Gosub alfa1, beta1
|
||||
Exit
|
||||
alfa1:
|
||||
Print "ok1"
|
||||
Return
|
||||
beta1:
|
||||
Print "ok2"
|
||||
Return
|
||||
}
|
||||
Print "End"
|
||||
}
|
||||
}
|
||||
CheckIt
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
a$="123"
|
||||
if a$ ~ "12*" then 1000
|
||||
alfa: ' only remarks here
|
||||
Print "print here, spaghetti code, marvelous"
|
||||
Exit
|
||||
1000 Print "ok final"
|
||||
Goto alfa
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
Module Checkit {
|
||||
Rem : Dim beta(10) ' remove Rem to get error when call beta() without Gosub
|
||||
Rem : Gosub beta() ' remove again Rem and erase next line to use beta() correct
|
||||
'beta()
|
||||
sub beta()
|
||||
local i
|
||||
for i=1 to 10
|
||||
alfa(i)
|
||||
next i
|
||||
end sub
|
||||
sub alfa(x)
|
||||
goto 100
|
||||
Print "no print"
|
||||
End Sub
|
||||
|
||||
100 Print "ok this printed", x
|
||||
Return
|
||||
}
|
||||
Checkit
|
||||
Loading…
Add table
Add a link
Reference in a new issue