equality madness


Last Updated: 2012-07-03 05:09:03
  1. tiagojanz

    tiagojanz New Member

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



    Code (Text):
    1.  
    2.  
    3. def found = false
    4. def explo make a list
    5.  
    6.                            Espinho
    7.                            Lisboa
    8.                            Santa Maria dos Olivais
    9.  
    10. web.gottext
    11. {
    12.      found = true
    13.      find(responseContent1)
    14.      ifelse(found)
    15.          then do{
    16.               some action
    17.          }
    18.         else do{
    19.               some other action
    20.         }
    21. }
    22.  
    23. find(search)
    24. {
    25.  
    26.      foreach local  in list explo
    27.     {
    28.         if test  text= (arg[0]:local, arg[1]:search)
    29.         {
    30.               set found = true
    31.         }
    32.  
    33.     }
    34. }
    35.  
    36.  
    37.  
    38.  
    39.  


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

    Advertisement
  2. appinventor

    appinventor Active Member

    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

Share This Page