Join GitHub today
switch on Strings #4034
I've tried to switch on String variables whith Processing 3. According to the documentation, this might not work : it should only be right with int, char or byte. Processing underlines the variable in red. Clicking on the variable, the message "Cannot switch on a value of type String. Only convertible int values, strings or enum variables are permitted." is displayed.
Nevertheless, if I try to lauch the code, it works as expected.
Can you please explain to me :
EDIT : I use JDK 8, which could explain why it works. If so, shouldn't we update the documentation and/or the software to indicate when it will work ?
added a commit
Oct 22, 2015
Hi @Sam22235, thank you for your report. There was a problem with error checker being set to Java 6 level, but String switches are available since Java 7. Processing uses its own Java, so it does not care if you have Java installed and what version it is.