Go Back   Android Forums > Android Development > Application Development > App Inventor

test: Reply
 
LinkBack Thread Tools
Old May 19th, 2012, 05:13 AM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: May 2012
Posts: 1
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default equality madness

Hi, I am trying to iterate trough a list, since I cant post images I'll try my best to post the code



Code:
def found = false
def explo make a list
  
                           Espinho
                           Lisboa
                           Santa Maria dos Olivais

web.gottext
{
     found = true
     find(responseContent1)
     ifelse(found)
         then do{
              some action
         }
        else do{
              some other action
        }
}

find(search)
{

     foreach local  in list explo
    {
        if test  text= (arg[0]:local, arg[1]:search)
        {
              set found = true
        }

    }
}


When search argument is Santa Maria dos Olivais it should find it in the explo list right?

Advertisements
tiagojanz is offline  
Reply With Quote
sponsored links
Old July 3rd, 2012, 12:09 AM   #2 (permalink)
Junior Member
 
Join Date: Mar 2012
Location: Louisiana, USA
Posts: 33
 
Device(s): Asus Eee Transformer
Carrier: Not Provided

Thanks: 1
Thanked 4 Times in 3 Posts
Default

tiagojanz, all you can use one of 2 built-in blocks:

[is-in-list?] returns true or false
[position in list] returns the index of the item or 0 if it is not found
appinventor is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development > App Inventor
Thread Tools

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

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



All times are GMT -5. The time now is 04:04 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.