Newsgroups: bit.listserv.i-amiga
Date:         Tue, 8 Sep 1992 15:07:06 CST
From:         "Alejandro J. Kurczyn S." <AKURCZYN@ITESMVF1.BITNET>
Subject:      Re: Beginners Guide To AREXX

>Do I = 1 to 100 : say I : end

Isn't that "Do i = 1 to 100; say i; end"?

>In Basic, if you wanted to fill an array you would do something like this:
>Dim fish(100)
>For I = 1 to 100
>input "Enter the data";fish(100)
>Next I
>
>Unfortunately, from my own experimentation and search, the closest to
>this that arexx allows you is the following
>fish.1= ' '; fish.2=' ';fish.3=' ';fish.4=' ';fish.5=' '....and so on
>to 100
>
>do I = 1 to 100
>Say 'Enter the data'
>parse pull answer
>fish.i= answer
>end

I think the following can work:

do i = 1 to 100
say 'Enter the data'
pull fish.i
end

>Parse is roughly equivalent to Input from basic

Parse is a lot more than just an "input" equivalent, it does exactly that:
it parses strings, you can do the following:

say 'Command?'
pull line                        /* The user enters "Open door" */
parse var line action object .   /* now Action='Open' and Object='door' */
                                 /* the rest of the string is ignored,  */
                                 /* Please notice the dot at the end    */

>Pull is just a option for cursor input.

Pull gets data from the stack, if it is empty then it waits for you to enter
something. You can put things in the stack, for example:

data='This is nothing'
push data
say 'Now we read it'
pull newdata

say 'It says:' data            /* Prints 'It Says: This is Nothing' */

Now on the program: :-)

>Parse pull answer

This option gets the user's answer but it doesn't modify it, so if the user
entered an 'a' or a 'b' they'll stay that way and will not be detected by
the following comparisons. The proper way to do it is:  Pull Answer  (parse
doesn't convert the input to upper case)

>if answer <> "A" and answer <> "B" then exit /* end script */
>if answer = "A" then address command "run dh0:wordprocessors/Prowrite";exit
>if answer = "B" then do
>    say "I am going to run amax"
>    address command "say -r"I am now going to run amax""
>    Address command "run dh0:emulators/amax"
>    end

You can do that with:

Select
  when answer=='A' then address command "run dh0:whatever/prowrite"
  when answer=='B' then do
       say "I'm going to run AMax"  /* Notice the double quotes that allows
                                       a single one in the string /*
       address command 'run dh0:emulators/amax'
       end
otherwise
 say 'Please enter A or B'
 say 'This is a dumb program you know?'
end


Hope this helps...

-Alejandro Kurczyn S.
+----------------------------------+------------------------------------------+
: IBM Systems Coordinator          : Electronic Mail:                         :
: Supercomputing Center            :                                          :
: ITESM Campus Estado de Mexico    : BITnet: AKURCZYN@ITESMVF1                :
: Mexico                           : InterNet: akurczyn@itesmvf1.rzs.itesm.mx :
:                                  :                                          :
: (5)370-4100 ext 5660             :                                          :
+----------------------------------+------------------------------------------+
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU