Android Question simplify the array procedure

Discussion in 'Android Questions' started by WhoIsShmoove, Jan 2, 2018.

  1. WhoIsShmoove

    WhoIsShmoove Active Member Licensed User

    Hi, everybody

    is it possible to simplify this

    Code:
    Private TheMarker(5As Marker
    Dim m1, m2, m3, m4, m5 As Marker
    TheMarker = 
    Array As Marker(m1, m2, m3, m4, m5)
    i don't no in B4A it possible make this

    Loop ($ vlElem; 1; Table Size (aArray))
    `Do something with the element
    anArray {$ vlElem}: = ...
    End of loop
     
    Last edited: Jan 3, 2018
  2. Peter Simpson

    Peter Simpson Expert Licensed User

    Code:
    'What to something like this?

        
    Dim TheMarker(5As String = Array As String("m1""m2""m3""m4""m5"'Also works without No. 5
     
        
    For Each m As String In TheMarker
            
    Log(m)
        
    Next
    I'm not quite sure what you're asking...
     
    Last edited: Jan 3, 2018
    WhoIsShmoove and metrick like this.
  3. Erel

    Erel Administrator Staff Member Licensed User

    Code:
    For Each m As Marker In Array(m1, m2, m3, m4, m5)
     
    Log(m)
    Next
     
    WhoIsShmoove and Peter Simpson like this.
  4. WhoIsShmoove

    WhoIsShmoove Active Member Licensed User

    thank you erel very very well as usual !
    however I have a list of marker and will not be defined how much in total because it evolves regularly and it is well the declaration of m1, m2, m3 etc ... that embarrasses me
     
  5. WhoIsShmoove

    WhoIsShmoove Active Member Licensed User

    Thank peter, you have perfectly understood the request in view of the answer I will try

    Code:
    For Each m As String In TheMarker
            
    Log(m)
        
    Next
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice