forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Looping through local variables

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up
View previous topic :: View next topic  
Author Message
dmonckton
Contributor
Contributor


Joined: 09 Aug 2002
Posts: 117
Location: Lewes, U.K.

PostPosted: Mon Jun 06, 2005 8:51 am    Post subject: Looping through local variables Reply with quote

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
View user's profile Send private message
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 480
Location: California

PostPosted: Mon Jun 06, 2005 12:36 pm    Post subject: Reply with quote

Hi dmoncton,

Try something like this...
Code:

repeat
  list add,1,%1
  shift
until @null(%1)


Hooligan

_________________
Hooligan

Why be normal?
Back to top
View user's profile Send private message
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 480
Location: California

PostPosted: Wed Jun 08, 2005 3:54 am    Post subject: Reply with quote

Did my last post help any? Question

Hooligan

_________________
Hooligan

Why be normal?
Back to top
View user's profile Send private message
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1565

PostPosted: Wed Jun 08, 2005 4:04 am    Post subject: Reply with quote

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
View user's profile Send private message
dmonckton
Contributor
Contributor


Joined: 09 Aug 2002
Posts: 117
Location: Lewes, U.K.

PostPosted: Wed Jun 08, 2005 8:36 am    Post subject: Reply with quote

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
View user's profile Send private message
dmonckton
Contributor
Contributor


Joined: 09 Aug 2002
Posts: 117
Location: Lewes, U.K.

PostPosted: Sun Jun 12, 2005 9:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group