nawrot Posted August 24, 2003 Share Posted August 24, 2003 Is it possible to modify the value being check in the condition using the while loop? for example, float c = 0 while( c < 5){ c+=1 } and it would ultimately return the value c=5? Quote Link to comment Share on other sites More sharing options...
FrankFirsching Posted August 24, 2003 Share Posted August 24, 2003 Yes, for sure, you will even have to. If you wouldn't be allowed to do this, a while loop would never terminate once the condition is true. The variable c in your example would have the value 5 at the end of execution. Quote Link to comment Share on other sites More sharing options...
nawrot Posted August 24, 2003 Author Share Posted August 24, 2003 Yes, for sure, you will even have to. If you wouldn't be allowed to do this, a while loop would never terminate once the condition is true. The variable c in your example would have the value 5 at the end of execution. Exactly. I guess I'm getting confused with the actual wiring of the vop. How does a simple piece of code like that wire up? The docs suggest setting your conditional on the loop to just equal one, and then do your actual if/then statements in the actual while loop. Here's the VFL of my vop: int c = 1 while( _condition != 0 ) { // Code produced by: while1/constant1 constant = 0; // Code produced by: while1/suboutput1 _condition = constant; } This seems like it should terminate after one loop, but it doesn't. Could you give be a better idea of how I should be approach the structue of the While Loop in vops? thanks! Quote Link to comment Share on other sites More sharing options...
FrankFirsching Posted August 25, 2003 Share Posted August 25, 2003 Using a constant of one wired into the condition outside the loop like the docs describe, behaves like a do { ... } while(condition inside the loop) in C/C++. I have attached a small example hip-file It creates a new (useless) point-attribute. It should show you how to setup a while loop in VOPs. But perhaps you are happier with writing your VEX-code in a text-editor. I have found, that loops are very tedious to wire in VOPs. whileTest.zip 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.