Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4android > Basic4android Updates and Questions
Documentation Wiki Register Members List Windows Mobile Search Today's Posts Mark Forums Read

Basic4android Updates and Questions Updates and questions regarding Basic4android.

For ... Next, Do While... Loop

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-05-2011, 03:01 AM
Junior Member
 
Join Date: Dec 2010
Posts: 35
Default For ... Next, Do While... Loop

I have the following sample code:

Quote:
For i = 0 To 10
l = j(i)
if l > 20 then
'I want to exit the loop
end if
Next
How can I exit the loop if certain conditions are met. Normally you would use "Exit For" statement in For loop but it doesn't work here.
I know I could change the value of i to max. value when I get into the "If... end if" code but I need to know the value of i that stopped the For loop in the rest of the code?
I guess I could assign value of i inside "If ... end if" to another variable before changing it to max value but that complicates the code (unnecessary).
The same is with While loop
Reply With Quote
  #2 (permalink)  
Old 01-05-2011, 03:26 AM
JesseW's Avatar
Senior Member
 
Join Date: Oct 2008
Posts: 312
Default

It's not Exit For, it's just Exit in B4A. It exits the inner most loop, no matter the structure (ie. For Next, Do Loop, Sub, etc..) I ran across this myself..
Reply With Quote
  #3 (permalink)  
Old 01-05-2011, 04:14 AM
Junior Member
 
Join Date: Dec 2010
Posts: 35
Default

Quote:
Originally Posted by JesseW View Post
It's not Exit For, it's just Exit in B4A. It exits the inner most loop, no matter the structure (ie. For Next, Do Loop, Sub, etc..) I ran across this myself..
Thanks for that.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Do Loop Until klaus Beta 2 12-04-2010 11:49 AM
Loop sound AJS Questions (Windows Mobile) 1 09-20-2010 02:01 PM
For loop with Images... Quent42340 Questions (Windows Mobile) 4 02-05-2010 07:18 PM
Exiting For Loop Saj Questions (Windows Mobile) 9 09-09-2009 05:01 PM
Do...Loop While Put Claude Questions (Windows Mobile) 1 07-24-2007 08:02 PM


All times are GMT. The time now is 12:11 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0