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

@ -4,7 +4,7 @@ cc = 2*10 /*assigns charser 20 ───► CC
dd = 'Adam' /*assigns chars Adam ───► DD */
ee = "Adam" /*same as above ───► EE */
ff = 10. /*assigns chars 10. ───► FF */
gg = '10.' /*same as above ───► GG */
gg='10.' /*same as above ───► GG */
hh = "+10" /*assigns chars +10 ───► hh */
ii = 1e1 /*assigns chars 1e1 ───► ii */
jj = +.1e+2 /*assigns chars +.1e+2 ───► jj */

View file

@ -11,11 +11,8 @@ parse var xxx nn oo pp qq rr
/*assigns ─5 ───► QQ */
/*assigns "null" ───► RR */
/*a "null" is a string of length zero (0), */
/*and is not to be confused with a null char.*/
cat = 'A cat is a lion in a jungle of small bushes.'
/*assigns a literal ───► CAT */
call value 'CAT', "When the cat's away, the mice will play."
/*assigns a literal ───► CAT */
yyy='CAT'
call value yyy, "Honest as the Cat when the meat's out of reach."
/*assigns a literal ───► CAT */

View file

@ -1,20 +1,8 @@
/*REXX pgm to do a "bad" assignment (with an unassigned REXX variable).*/
signal on novalue /*usually, placed at pgm start. */
xxx=aaaaa /*tries to assign aaaaa ───► xxx */
say xxx 'or somesuch'
exit
novalue: /*this can be dressed up better. */
badLine =sigl /*REXX line number that failed. */
badSource=sourceline(badLine) /*REXX source line ··· */
badVar =condition('D') /*REXX var name that's ¬ defined.*/
say
say '*** error! ***'
say 'undefined variable' badvar "at REXX line number" badLine
say
say badSource
say
exit 13
call value 'CAT', "When the cat's away, the mice will play."
/*assigns a literal ───► CAT */
yyy='CA'
call value yyy'T', "Honest as the Cat when the meat's out of reach."
/*assigns a literal ───► CAT */
yyy = 'CA'
call value yyy || 'T', "Honest as the Cat when the meat's out of reach."
/*assigns a literal ───► CAT */

View file

@ -1,7 +1,20 @@
var.='something' /* sets all possible compound variables of stem var. */
x='3 '
var.x.x.4='something else'
Do i=1 To 5
a=left(i,2)
Say i var.a.a.4 "(tail is '"a||'.'||a||'.'||'4'"')"
End
/*REXX pgm to do a "bad" assignment (with an unassigned REXX variable).*/
signal on noValue /*usually, placed at pgm start. */
xxx=aaaaa /*tries to assign aaaaa ───► xxx */
say xxx 'or somesuch'
exit
noValue: /*this can be dressed up better. */
badLine =sigl /*REXX line number that failed. */
badSource=sourceline(badLine) /*REXX source line ··· */
badVar =condition('D') /*REXX var name that's ¬ defined.*/
say
say '*** error! ***'
say 'undefined variable' badvar "at REXX line number" badLine
say
say badSource
say
exit 13

View file

@ -0,0 +1,18 @@
/*REXX pgm shows different scopes of a variable: "global" and "local".*/
q = 55 ; say ' 1st q=' q /*assign a value ───► "main" Q.*/
call sub ; say ' 2nd q=' q /*call a procedure subroutine. */
call gyro ; say ' 3rd q=' q /*call a procedure with EXPOSE. */
call sand ; say ' 4th q=' q /*call a subroutine or function. */
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────SUB subroutine──────────────────────*/
sub: procedure /*use PROCEDURE to use local vars*/
q = -777 ; say ' sub q=' q /*assign a value ───► "local" Q. */
return
/*──────────────────────────────────GYRO subroutine─────────────────────*/
gyro: procedure expose q /*use EXPOSE to use global var Q.*/
q = "yuppers" ; say 'gyro q=' q /*assign a value ───► "exposed" Q*/
return
/*──────────────────────────────────SAND subroutine─────────────────────*/
sand: /*all REXX variables are exposed.*/
q = "Monty" ; say 'sand q=' q /*assign a value ───► "global" Q*/
return

View file

@ -0,0 +1,7 @@
aaa. = 'nope.' /*assign this string as a default*/
aaa.1=1 /*assign 1 to first element.*/
aaa.4=4. /* " 4 " fourth " */
aaa.7='lucky' /* " 7 " seventh " */
do j=0 to 8 /*go through a bunch of elements.*/
say 'aaa.'||j '=' aaa.j /*display element # and its value*/
end /*we could've started J at -100.*/

View file

@ -0,0 +1,4 @@
radius=6.28 /*assign a value to a variable. */
say 'radius =' radius
drop radius /*now, "undefine" the variable. */
say 'radius =' radius

View file

@ -0,0 +1,7 @@
var.='something' /* sets all possible compound variables of stem var. */
x='3 '
var.x.x.4='something else'
Do i=1 To 5
a=left(i,2)
Say i var.a.a.4 "(tail is '"a||'.'||a||'.'||'4'"')"
End