NoName
1
can i re-declare the variables in curly braces after declaring the string array?
/
String [] test = new String [500];
void setup(){}
void draw(){
test [] = {“shshsj”, “sjjsjsjs”, “2+288383”};
}
</
this does not work.
How can I do it more correctly. Through square [] brackets I can, but it doesn’t fit right now. I need {}.
1 Like
Curly brackets are used to initialise the array,
So
String [] test = {“shshsj”, “sjjsjsjs”, “2+288383”};
This means the array is now of size 3, and cannot be changed.
The values can however ie
test[0] = "string";
Or you can do
String [] test = new String [500];
Then
test[0] = "string";
test[1] = "string";
And so on...
If you are unsure of the size required then use lists or arraylists
1 Like
NoName
4
Can’t I reinitialize the array after a certain time through curly braces?
Yes but then you will lose all previously stored values
NoName
6
I agree. please help me figure out how to do this.
Sorry not possible once initialised with curlys
Normally I only use curlys if I already know what I want in the array
1 Like
NoName
8
In any case, thanks for being able to sort this out. now I know that it will not be possible to use {}.
<3
What is it you’re trying to achieve if you describe your problem I can probably give you a more appropriate solution.
1 Like
NoName
10
It doesn’t matter anymore, curly braces were needed only for convenience, square brackets would also work. Thank you for your help. Hugged.
1 Like