BUG in arrays
Arrays in fuze have a bug,
if you set Int, float , Struct in array everything is working fine, but string array have a bug ;
Exemple with Integer:
array a = [33,15,-54] loop clear() print(a) update() repeat
Execute the program and on the display you can see 15, it's normal.
Now, with string :
array a = ["Robert","Evan","Dave"] loop clear() print(a) update() repeat
Now, on the display you can see : ["Robert","Evan","Dave"]
like that,direcly ! What ???? this should happen with the syntax: print(a)
Normaly you must see "Evan" It's a bug or It's me ?
This does seem like a bug with the array initialization to me
With the size specified each element of the array seems to contain an array with all 3 elements.
The following behaves as expected
a = ["Robert","Evan","Dave"] loop clear() print(a) update() repeat
I will report it. Thanks for your report
There is some misunderstanding here I think. I do not think there is a bug here.
The way you are declaring the array is a shorthand syntax to initialise an array of 3 elements each of which containing an array of 3 defined elements.
I am confused because your first example should not print a single number. It should print [33,15,-54], since that array of 3 elements is stored in each element of your array called 'a'
array a = [15, 64, 2]
This is the same as doing this:
a = [ [15, 64, 2], [15, 64, 2], [15, 64, 2] ]
Same applies to the strings. If the first example does indeed only print a single number, then that would be a bug. However, I just tested this on our development build and the retail version and both are working as we'd expect. I'm not sure why you got a readout of just a single number..
Yes you are right, I should have done more testing Yes in the fuze help menu the declaration is like that :
array a a = 15 a = 64 a = 2
It is the reflex of c ++ ... In c++ you can set all your array in one line
@EvanTropFun You can declare this in one line in fuze too!
a = [15, 64, 2]
The Help tutorial for Arrays does show the first, long method first just for clarity. Below that is a shorthand declaration. Both of the below examples produce the same result:
array answers answers = "It is certain!" answers = "It does not look good..." answers = "You might be in luck!" answers = "Definitely not"
answers = [ "It is certain!", "It does not look good...", "You might be in luck!", "Definitely not" ]
This one could be declared on one line too:
answers = ["It is certain!", "It does not look good...", "You might be in luck!", "Definitely not"]
@Dave Ok I will remember this syntax Thanks you !
@EvanTropFun Well I obviously didn't!