Hello there, I wrote some VEX and need help to understand why it actually works
As you can see, I iterate over the points in a specific radius and then set the color of the attributes to Blue if one of the “nearpoints” has the attribute “heat” with a value of “1”
But why does this actually work. I don't understand why I have to put in the iteration number “num” instead of just “ptnum”
Is the order of the “ptnum” in the “foreach loop” reset? Or how can I understand this?
I'm sorry for my mediocre explanatory skills. I hope you still can understand it.
I very much appreciate your help guys.
Need Help understanding my VEX Code (For each Loop)
1416 3 1- Lucca
- Member
- 42 posts
- Joined: March 2019
- Offline
- c0y
- Member
- 52 posts
- Joined: June 2016
- Offline
- Houseo_of_Secrets
- Member
- 6 posts
- Joined: Nov. 2015
- Offline
- Lucca
- Member
- 42 posts
- Joined: March 2019
- Offline
c0y
I think it's because you are looping though the npts array. So @ptnum don't have the same numbers. That's why you need the int num;
I tested a little bit to visualize what the “num” (so the iteration) is actually doing and found out that it is returning the actual value of the current index in the array. So if the array has values like "“ it actually returns those values, so the @ptnum still have the same numbers. That is also the reason why I can use it hear to turn the Color of the Points blue with ”num"
Thanks for your responses
Greetings Lucca
Edited by Lucca - July 22, 2020 05:13:15
-
- Quick Links