Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stem's 0th variable

Status
Not open for further replies.

rajesh082

Programmer
Dec 18, 2007
38
DK
Rem. = 0
Do i=1 to 3
Pull Var1
rem.i = Var1
End
Say rem.0
Do i = 1 to rem.0
Say rem.i
Say rem.0
End

The out put is 3 & 0

Is it true that the Stem's 0th variable doesnt get set automatically. Is there any specific function to set the variable?
 
Is it true that the Stem's 0th variable doesnt get set automatically.

Yes.

Is there any specific function to set the variable?

No.
 
...although you could do something like this: ;-)
Code:
pull var1 .
parse value rem.0+1  var1   with  ,
             $z      rem.$z   1 rem.0  .

This code is not exactly "intuitive", so let me lead you by the hand...

"value rem.0+1 var1" represents a string which in the first instance is "1 3". This gets parsed such that
Code:
$z = 1 
rem.1 = 3
then the pattern is reset to position '1' and re-parsed such that
Code:
rem.0 = 1

The net is that you do in one motion what would otherwise take several assignments, and no one will dare touch your code because they haven't the first clue what it's doing ;-)


Frank Clarke
Support the Troops:
-- Bring them home.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top