| View previous topic :: View next topic |
| Author |
Message |
dmonckton Contributor


Joined: 09 Aug 2002 Posts: 117 Location: Lewes, U.K.
|
Posted: Mon Jun 06, 2005 8:51 am Post subject: Looping through local variables |
|
|
Hi
How do I write a loop to work through variables passed to a function or command. This obviously won't work.
| Code: |
:test
%i = 1
%l = 8
repeat
%a = %%i
etc...
%i = @succ(%i)
until @greater(%i,%l)
exit
|
Thanks |
|
| Back to top |
|
 |
Hooligan VDS Developer


Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Mon Jun 06, 2005 12:36 pm Post subject: |
|
|
Hi dmoncton,
Try something like this...
| Code: |
repeat
list add,1,%1
shift
until @null(%1)
|
Hooligan _________________ Hooligan
Why be normal? |
|
| Back to top |
|
 |
Hooligan VDS Developer


Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Wed Jun 08, 2005 3:54 am Post subject: |
|
|
Did my last post help any?
Hooligan _________________ Hooligan
Why be normal? |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1565
|
Posted: Wed Jun 08, 2005 4:04 am Post subject: |
|
|
| dmonckton, this is a little off topic. But your profile picture - where exactly did you get that image? I could have sworn I've seen it on tv or in a movie I just can't remember where I've seen it. |
|
| Back to top |
|
 |
dmonckton Contributor


Joined: 09 Aug 2002 Posts: 117 Location: Lewes, U.K.
|
Posted: Wed Jun 08, 2005 8:36 am Post subject: |
|
|
Hi
Thanks for the help, I think the shift will work I'll give it a try today. I'll
post up the results.
My profile picture is a Cyberman from the Dr Who TV series made by the BBC. I made it with my scanner at home and turned it into a t-shirt, is that sad?
Cheers
David... |
|
| Back to top |
|
 |
dmonckton Contributor


Joined: 09 Aug 2002 Posts: 117 Location: Lewes, U.K.
|
Posted: Sun Jun 12, 2005 9:26 pm Post subject: |
|
|
Hi
Thanks for the help, finished the stack command now
| Code: |
rem place items on the stack
:s>
repeat
if @zero(@count(%%stack))
list add,%%stack,%1
else
list seek,%%stack,0
list insert,%%stack,%1
end
shift
until @null(%1)
exit
|
Cheers
David.. |
|
| Back to top |
|
 |
|