Navigation

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

    Variables vs arrays ?

    General Discussion
    4
    6
    428
    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.
    • tdg8934
      tdg8934 last edited by

      I’m trying to fully understand using one versus the other. Before I was just trying to get my program not to error and have it work but I see so many variations in how arrays versus (variables?) should be listed.

      string person=[] //use ‘string‘ or not?
      person[0]=“Tim”
      person[1]=“Dave”
      person[2]=“Joe”

      Or

      person=[1] //use ‘string‘ or not?
      person[0]=“Tim”
      person[1]=“Dave”
      person[2]=“Joe”

      Or

      string person=[3] //use ‘string‘ or not?
      person[0]=“Tim”
      person[1]=“Dave”
      person[2]=“Joe”

      Or

      array person [1]
      person[0]=“Tim”
      person[1]=“Dave”
      person[2]=“Joe”

      Or

      array person [3] //this looks right to me
      person[0]=“Tim”
      person[1]=“Dave”
      person[2]=“Joe”

      Can someone explain this to me?

      1 Reply Last reply Reply Quote 0
      • PickleCatStars
        PickleCatStars F last edited by PickleCatStars

        As far as I know they’ll all work, because the arrays grow automatically if you add more things, and also because fuze automatically handles types (string, int, vector, float).

        It’s a bit confusing to me too, I change up the way I do it depending on if I want to remind myself what type of data I’m keeping in them, or if I know I’m going to be adding things only one at a time, or if I’m trying to save memory. It just depends.

        That first one is new to me though...

        tdg8934 1 Reply Last reply Reply Quote 1
        • tdg8934
          tdg8934 @PickleCatStars last edited by tdg8934

          @toxibunny thanks.

          I just went to the main Fuze site and saw there were 2 coding books to download and saw this in the second one on arrays

          ![alt text](1CB357EE-9D02-4CED-880A-9894496DE692.png image url)

          Information like this should be in the Fuze Help. I didn’t even know about the 2 coding downloads.

          Currently the Fuze help on Array only lists this:

          array myArray[elements]

          The download was much more helpful.

          1 Reply Last reply Reply Quote 1
          • xevdev
            xevdev F last edited by

            I noticed this in your code and was wondering why you were doing that.
            A lot of your assigning of values looked exactly the same. the only thing that changed was the number of the array slot. A loop would be a better way.
            Also with arrays
            How_many_person = len( person )
            For I = 0 to how_many_person loop ...... repeat
            That way your always got the correct length of the array

            tdg8934 1 Reply Last reply Reply Quote 2
            • tdg8934
              tdg8934 @xevdev last edited by tdg8934

              @xevdev I printed out both coding projects books. I just finished reading both and these should be must reads!

              There is so much more info than what’s in the Fuse Help especially on Arrays, structures and functions.

              I’m planning on cleaning up my current FTA program in the arrays and better use of functions and structures.

              Tim

              link text

              Gameboy 1 Reply Last reply Reply Quote 4
              • Gameboy
                Gameboy F @tdg8934 last edited by

                @tdg8934 I didn’t even know these books existed, thank you!

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