Sign in to follow this  
Followers 0
stolie

Loop 10 times--noob

14 posts in this topic

Hi all

I have a script that i only want to repeat say 10 times

How do i use the for/next, or loop function

thanks in advance

:)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

MyLoopFunc()
Func MyLoopFunc()
For $i = 1 to 10
(code here)
Next
(more code if needed)
EndFunc

Edited by BL@(K-R34P3R

Share this post


Link to post
Share on other sites

Thankyou very much, much appreciated

:)

Share this post


Link to post
Share on other sites

Black and his functions *sigh* lol


My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]

Share this post


Link to post
Share on other sites

FuncTi0ns r00l d00d!

Share this post


Link to post
Share on other sites

are'nt functions pretty much the same as routines and subroutines?

like goto and gosub. i remember reading somewhere in here that they were evil, and it made spaghetti code.

is it not a good idea to write a script, that is more "managed" and is completely divided into functions?

thats what i used to do with autoit 2. now i just make comments in my code to keep track of whats what.

are functions better added only when you want something done repeatedly in a script?

would it be "bad programming" to write your entire script with functions?


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

You can write bad code without using functions, and you can write bad code with functions.

Functions are just a tool, and they by themself do not make your script any better nor any worse.

That said, funtions can make your script a lot better, and use far less lines.

Functions are a great tool, and they make great for great code. It all comes down to GIGO.

If we still have the article, you should read "Goto is evil." :)

edit... AutoIt is basically does all its work with functions, and UDFs....

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

You can write bad code without using functions, and you can write bad code with functions.

Functions are just a tool, and they by themself do not make your script any better nor any worse.

That said, funtions can make your script a lot better, and use far less lines.

Functions are a great tool, and they make great for great code. It all comes down to GIGO.

If we still have the article, you should read "Goto is evil." smile.gif

edit... AutoIt is basically does all its work with functions, and UDFs....

\

FuNcTi0Ns r00l d00d!

Share this post


Link to post
Share on other sites

Is there an echo in here?


Who else would I be?

Share this post


Link to post
Share on other sites

I believe there is.

@t0ddie: Functions don't make a script any better or worse like what scriptkitty said, but in BL@(K's script, the function is unneeded.


My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]

Share this post


Link to post
Share on other sites

I just like to have them. Partially because I like to have a name for a set of actions. I don't know why, but I have scripted in Dr Scheme, Java, Visual Basics, C++, AutoIt, and video game scripting and in all of them I luvvvv making functions. =/

Share this post


Link to post
Share on other sites

FYI Black, VB, C++, and Java are not "scripting" languages... you have never "scripted" in any of them. There is VBScript, Javascript, and several C variants in the form of scripting languages... but if you have used VB, C++ or Java then you have "coded" in those languages. There is a difference, just go google it. BTW how have you used so many languages yet you still have ABSOLUTLY NO clue when it comes to computers? Must be the product of public technology education. I hope you don't plan to bring your "scripting" skills to the real world.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

I didn't mean that I have actually "coded" or "scripted" with all of them in a 1337 manner! I am n00b to more than one of them! I am just saying that I know how to read the code to get a general idea of what they are doing. So I suppose you can laugh now. Haha. =/

The ones that I have actually coded in is DrScheme, AutoIt, Java, a LITTLE VB, and various video game coding with their own language, (Morrowind).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0