Re: Variable naming in Euphoria
- Posted by futures8 <futures8 at PCOLA.GULF.NET> Aug 11, 2000
- 422 views
Wow! Thanks to all the many suggestions offered by people on this list, within minutes of my posted question. I've carefully reviewed each of them. When reading Matt Lewis's response and Lewis Townsend's, the light came on for me (duh!) when each of them pointed out that a subscripted sequence element is, in fact, a unique variable name, or, at least, can be considered so. Thanks, Matt and Lewis. Thanks also to Kat, Mike Sabal and Alex Ford for their insights. I will be looking into the libraries mentioned, when time permits. futures8 wrote: > I'm new to Euphoria, so my question will seem very basic to those on the > list. > Hope some kind soul will offer some suggestions. > > Some languages have the capability to programatically create variable > names; the following example from Foxpro demonstrates what I'm hoping > can somehow be done in Euphoria. I have checked the Euphoria docs and > various other Euphoria programs submitted to the archives by others, but > haven't found and examples of what I'm looking for; > . > ----------------------------------------------------------------------------- > > if reccount() - recno() < 10 > k = reccount() - recno() > else > k = 10 > endif > > for i = 1 to k > j = alltrim(str(i)) -- makes j a character > respresentation of the integer i > store val(CLOSE) to Price&j > skip > next i > > --------------------------------------------------------------------------------- > > the loop iteratively creates variables Price1, Price2 ...Price10 and > assigns them a value. > The concatenation operator in Euphoria will catenate the contents of > sequences, but not variable names. > > Is there a way to similarly create (declare) and assign variable names > on the fly in Euphoria? > > Any suggestions will be appreciated. > > Thanks. > > Jim