Dumb Question About Variables (Revisited)

Robert Brenstein rjb at rz.uni-potsdam.de
Tue Mar 26 11:05:00 EST 2002


>Hi Everyone,
>
>      A few days ago I asked about creating variables on the fly.  It was
>suggested that I enclose the unchanging part of the variable name in
>quotations.  So I tried the repeat loop below as an experiment, hoping to
>generate H1 = 11, H2, =12, and so on, up to H10 =20.
>
>  repeat with i = 1 to 10
>     put i+10 into ("H" & i)
>  end repeat
>
>      It doesn't fly, unfortunately, and the error message I get is bad
>chunk and a reference to the left parenthesis.  Removing the parenthesis
>doesn't help, but makes H the bad chunk.  However, I remember being able
>to do this in HyperCard.  Any thoughts?
>
>      By the way, the technique above (as I think everyone knows) works if
>the container is a field rather than a variable.
>
>      put i+10 into fld ("H" + i)   -- not a problem
>
>      Greg
>

try

  repeat with i = 1 to 10
     do "put" && (i+10) && "into" && ("H" & i)
  end repeat

Robert



More information about the metacard mailing list