kepler Active Member Licensed User Longtime User Mar 16, 2015 #1 Hello again, In my current script, I've tryed to do a Loop routine, similar to VB, but with the B4A rules. The routine in VB is something like this: Code: Copy Do (...procedures1...) If nt > sd Then Exit Loop ' ---------- EXIT End If (...procedures2...) Loop I've tryed: Code: Copy Do Until (nt > sd) (...procedures1...) (...procedures2...) Loop But, from the several results I get, the last one is always wrong - so I suspect that this Loop in B4A is not working properly mainly because it's running procedures2 in sequence of procedures1. Any tips or workarounds on this issue? Kind regards, Kepler Last edited: Mar 16, 2015
Hello again, In my current script, I've tryed to do a Loop routine, similar to VB, but with the B4A rules. The routine in VB is something like this: Code: Copy Do (...procedures1...) If nt > sd Then Exit Loop ' ---------- EXIT End If (...procedures2...) Loop I've tryed: Code: Copy Do Until (nt > sd) (...procedures1...) (...procedures2...) Loop But, from the several results I get, the last one is always wrong - so I suspect that this Loop in B4A is not working properly mainly because it's running procedures2 in sequence of procedures1. Any tips or workarounds on this issue? Kind regards, Kepler
DonManfred Expert Licensed User Longtime User Mar 16, 2015 #2 Last time: please use code tags when posting code!!!!!!! Upvote 0
RandomCoder Well-Known Member Licensed User Longtime User Mar 16, 2015 #3 If you need to run procedures1 at least once before checking if nt > sd you could call it before entering the Do Until Loop. It's rather difficult to provide better help without knowing what your code does? PS. You can exit the loop at any time using the command "Exit". Upvote 0
If you need to run procedures1 at least once before checking if nt > sd you could call it before entering the Do Until Loop. It's rather difficult to provide better help without knowing what your code does? PS. You can exit the loop at any time using the command "Exit".
kepler Active Member Licensed User Longtime User Mar 16, 2015 #4 Can you take it easy?!!!! I've just read your input code instructions in the other post. If I knew how to do it, I wouldn't do it wrong again. It's not my fault if you're upset today... Take it on someone else, please. Kepler Upvote 0
Can you take it easy?!!!! I've just read your input code instructions in the other post. If I knew how to do it, I wouldn't do it wrong again. It's not my fault if you're upset today... Take it on someone else, please. Kepler
kepler Active Member Licensed User Longtime User Mar 16, 2015 #5 Sorry RandomCoder. Here's the code: Code: Copy While True ad = ad + syn k2 = k1 + 1 nt2 = Modulate(ad, k2) If nt1 <= sd And nt2 > sd Then Exit While ' ---------- EXIT End If nt1 = nt2 k1 = k2 End While Kind regards, Kepler Upvote 0
Sorry RandomCoder. Here's the code: Code: Copy While True ad = ad + syn k2 = k1 + 1 nt2 = Modulate(ad, k2) If nt1 <= sd And nt2 > sd Then Exit While ' ---------- EXIT End If nt1 = nt2 k1 = k2 End While Kind regards, Kepler
RandomCoder Well-Known Member Licensed User Longtime User Mar 16, 2015 #6 Hi @kepler is the code you posted working as you expect now or is there still a problem. I'm unsure? Upvote 0
kepler Active Member Licensed User Longtime User Mar 16, 2015 #7 Hi. The code I've posted is in VB, as you know - and it works fine. My adaptation to the language of B4A, however, gone terribly wrong up until now... It works this way: Code: Copy Dim temp as Boolean = True Do While temp ad = ad + syn k2 = k1 + 1 nt2 = Modulate(ad, k2) If (nt1 <= sd And nt2 > sd) Then Exit nt1 = nt2 k1 = k2 Loop Kind regards, Kepler Upvote 0
Hi. The code I've posted is in VB, as you know - and it works fine. My adaptation to the language of B4A, however, gone terribly wrong up until now... It works this way: Code: Copy Dim temp as Boolean = True Do While temp ad = ad + syn k2 = k1 + 1 nt2 = Modulate(ad, k2) If (nt1 <= sd And nt2 > sd) Then Exit nt1 = nt2 k1 = k2 Loop Kind regards, Kepler
RandomCoder Well-Known Member Licensed User Longtime User Mar 16, 2015 #8 @kepler I'm glad you've got it sorted, I only quickly read your previous example and thought that it was already written in B4A, which was why I couldn't understand what wasn't working. As you've now shown with the working code, there's very little difference between VB and B4A (just enough difference to trip us up! ). I program in a variety of similar but different languages and specialise in none, so I'm forever having to look up the correct syntax. Upvote 0
@kepler I'm glad you've got it sorted, I only quickly read your previous example and thought that it was already written in B4A, which was why I couldn't understand what wasn't working. As you've now shown with the working code, there's very little difference between VB and B4A (just enough difference to trip us up! ). I program in a variety of similar but different languages and specialise in none, so I'm forever having to look up the correct syntax.