kstrev Posted September 15, 2021 Share Posted September 15, 2021 Hi There, I am trying to procedurally grab an operator from an array ex. array("*","+","/","-") and use it inside a loop to do a simple calculation. Here is an example: string operators[] = array("*","+"); f@tmp = 1; for(int i=0;i<chi("iter");i++){ f@tmp `operators`= 2; //how do I convert the operators result to something meaningful for vex? } When I use an "i" as an index it doesnt error but it ignores whatever is inside the ``. If I add 0 as an index I am getting an error. I have managed to make it work with an ordered menu by using `chs("orderedMenu")` and that works fine, although is not as flexible. In my case I don't want to use this approach cause I am going to end up with various different ordered menus. I would prefer if I could store the values of the ordered menus in an array and run it in a loop. Probably I don't understand the difference of the result between the ordered menu and the array and I am not even sure whether what I am trying to do is valid. If anyone could help with this would be great! I have attached a simple example in case anyone would like to have a look. Thanks in advance guys, Kostas operators_example_1.hipnc Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.