|
|
Joined: Nov 2003
Posts: 1
Mostly harmless
|
OP
Mostly harmless
Joined: Nov 2003
Posts: 1 |
Will the For Next Loop, Do While Loop ever be added to mirc scipting ?
Thanks Greystone
|
|
|
|
Joined: Feb 2003
Posts: 309
Fjord artisan
|
Fjord artisan
Joined: Feb 2003
Posts: 309 |
Ugh. Already mirc script is sadly an organically grown thing without standard features between common comamnds (Some support say negative inputs which do something you'd expect, others don't, others still want strings where it makes little sense) Its vaguely C like; but only in the vaguest of vaugeness.
Yet you want to take a visual basic (UGGGGHHH) approach to things?
For now; use this instead.
var %i = 0 var %MAX = 10 while (%i < %MAX) { ;do stuff inc %i }
or
var %boolean = $true while (%boolean) { if (condition == condition) { unset %boolean } else { ;Stuff } }
Perfectly adequate solutions without messing around with the feel of the language
|
|
|
|
Joined: Dec 2002
Posts: 266
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 266 |
DO WHILE loops are non-guarded (post-test loops), so they're completely inefficient, aka completely useless.
You won't like it when I get angry.
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
Huh? There are plenty of situations where a Do...While loop is the practical method to do something. It's because it doesn't check conditions until one iteration which makes it useful in those situations. I think the fact that Do...While loops exist in the majority of programming and scripting languages is proof enough that they're not completely useless.
That said, there's no real necessity for them in a scripting language like mIRC's, I wouldn't really mind if they were added or not.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Dec 2002
Posts: 266
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 266 |
Yes I agree, and after thinking about it for a few minutes there have been cases where I've used them myself. But the fact still remains that they are significantly inefficient compared to a simple WHILE/FOR loop, especially when used on volume load projects.
You won't like it when I get angry.
|
|
|
|
Joined: May 2003
Posts: 161
Vogon poet
|
Vogon poet
Joined: May 2003
Posts: 161 |
in c, and in perl, a do while loop is actually faster than a regular while.
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
(and a reply to Ashkrynt)
I don't see how a Do...While loop can be called faster, slower, or less efficient than a While/For loop, they all have their place where they're the most effective. When you need something to be performed at least once regardless of any conditions then a Do...While loop will be better all round than hacking it together with a While loop, and of course the reverse is true when you always want the condition to be checked first.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
|
|