Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Find out how many items in an Array

    Beginners
    2
    3
    172
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      eNDyGee last edited by

      I've recently picked up Fuze and have been working through the tutorials and had a question about knowing how many items are in an array in the for loop example which explicitly states:

      for i = 0 to 5 loop
      print( names[i] )
      repeat

      Could you have something that would say 'for i = 0 to [number of array items]'? so that you could add more items to the array but not have to adjust the loop amount?

      Hope that makes sense!

      1 Reply Last reply Reply Quote 0
      • pianofire
        pianofire Fuze Team last edited by pianofire

        @eNDyGee Perfect sense. The len function

        https://fuzearena.com/help/view/len

        returns the length of a string or array so you can do

        for i = 0 to len( names ) loop
            print( names[i] )
        repeat
        
        1 Reply Last reply Reply Quote 2
        • E
          eNDyGee last edited by

          That's great - Thankyou!

          1 Reply Last reply Reply Quote 1
          • First post
            Last post