bb3d feature request
Blitz3D Forums/Blitz3D Programming/bb3d feature request
| ||
This would be a useful feature in blitz. The ability to use And in a For loop. This way, instead of writingb = 0 For i = 0 To 5 ;Blah b = b + 1 next I could write For i = 0 To 5 And b = 0 To 5 ;Blah Next |
| ||
eh, in your first example b would always be 1 |
| ||
oh yah, thanks. |
| ||
exactly how would this work? 0-5 for each of them fair enough, but how would this work: for i = 0 to 9 and b = 0 to 4 ;blah Next |
| ||
And so ended another american dream. |
| ||
:D and what's the difference between that and:For i = 0 To 5 b=i ;Blah Next Less keystrokes anyway if you're looking at it from a C point of view [edit]Maybe he means it would be like this to the compiler: For i = 0 To 5 For b = 0 To 5 ;Blah Next Next |
| ||
unger baby |
| ||
[edit]Maybe he means it would be like this to the compiler: For i = 0 To 5 For b = 0 To 5 ;Blah Next Next Except that wouldn't really save anything at all, except maybe a tab. |
| ||
Well, I could see the equivalent of this happening:For N = 0 To 8 And B = 5 To 7 Next [code] Sortof like this: [code] NStart# = 0 : NEnd# = 8 : NDelta# = NEnd#-NStart# BStart# = 5 : BEnd# = 7 : BDelta# = BEnd#-BStart# For N# = NStart To NEnd B# = BStart+(N# / NDelta#)*BDelta# Next Pseudo-code, really, but I think it works in general. In any case, I disagree with this feature request. It's illogical, in my opinion. |
| ||
I did my example wrong... The idea would be to have two numbers, both starting at different values, and adding the Step value to themselves every loop. So, you could have For a = 0 To 5 And b = 5 To 10 Next To prevent screwups, perhaps a Start operator could be used instead of the two seperate variables. For a = 0 To 5 And b Start 5 Anyway, it's just a crazy idea. There's some pretty good reasons why not to do it, but it could be kind of useful now that I've clarified my idea. |
| ||
Ummm...?For a=0 To 5 b=a+5 Next |
| ||
bah fine. |
| ||
I've clarified my idea. Not too well, though. Present a situation where this would actually be useful. |
| ||
Uhm, once again, I'm going to clarify. For t.type = each type And numberTypes = Start 0 ;blah Next This way, it could count type instances... I have realised how utterly useless this can be on most occasions, so Gah, Fine, it looks like you're right again. I'll just back away, burn the evidence of this post, and hide in my room for a few weeks. |
| ||
:P Well at least that one is remorlty useful |
| ||
For t.type = each type And numberTypes = Start 0 ;blah Next One line more: For t.type = each type numberTypes = numberTypes + 1 ;blah Next I don't think you really thought your request through at first- just came up with some slightly-interesting idea and posted it. |
| ||
just came up with some slightly-interesting idea and posted it. Hehe, yep. It seemed useful at the time though, maybe I forgot something. Please stop adding replies to this before I go crazy with embarassment :D |