Jump to content

While loops in VEX


nawrot

Recommended Posts

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...