Currently, if I define a group of different rows, I do it like this:
string a = "A"; string b = "B"; string c = "C"; string d = "D"; string e = "E";
Is there an easier way to define all these lines on one line?
You can do
string a = "A", b = "B", c = "C", d = "D", e = "E";
even if I prefer one ad per line.
or maybe you need an array?
string strings[5] = {"A", "B", "C", "D", "E"};
and then use strings[0] to strings[4] .
strings[0]
strings[4]
You can also do:
Technically this is one liner, but it's easier for me to read than:
An easier way to do this would be
String letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
Then calling the corresponding letter with
letters[0]; //"A" letters[1]; //"B" //etc.
Alternatively, you can use the char value to get the correct index of the string containing letters.
You can use Array, Vector, or List if you have the number of related strings as you defined.,.