We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
I wonder if it is possible to use the content of a String as an evaluation request in an If-function.
I am very new to processing and am working on a longer code, the if requests gets generated by a for();
Happy for every help!
Thanks.
request = "(1 < 2) & (1 < 3)";
if (request) {
println("ok");
}
Answers
maybe look here
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval
You can't do this in Java mode. You'll need to parse the Strings yourself, or come up with a new design.
You can do this with JavaScript through Processing.js, which is what Chrisir is mentioning.
If you are using Java Mode then you can use the Jasmine library but you would have to use the logical and/or (&& ||) instead of the bitwise and/or (& |).
That's cool. : - )
Also complete overkill for 90% of people with this question :p