Forum

If statement?

what nodes give me an if statement? like “if the incoming value is greater than 1 {condition}”.

Have a look at: basic-programming-concepts

So your saying v doesnt follow basic programming concepts? cause i can write

if ( n > 1) {

n + 1

};

and have it increment everytime it goes above 1, but if i use a > node and set it to 1, then connect the output to a + node and set its addition to 1 it wont increment.

Maybe the attached patch will help you on your merry way to understanding vvvv’s logic.

If it doesn’t help solve your problem; upload a patch and someone will help you out!

if_greater_than.v4p (4.2 kB)

thanks for the patch, thats actually more confusing cause i was looking for it to increment everytime it satisfied a certain condition, in this case the condition is only satisfied is it goes from below 1 to over 1. Removing the togedge made it ramp up rapidly, how do i get it to say If condition=true,{do this}?

No, It’s not limited. Gaz’s patch exactly answers your question above. However, You shall build your own way of logic for your conditions.

Let’s say you have = and you trace if the output is 1 or 0 where the = node may have any parameter within. You may have multiple = incase your logic demands and may have AND to detect only if both = are on. Finally you may have a switch which works like if this toggle is on do this else do that.

You need to learn about Bangs and vvvv frames if you want to understand what is happening to to the counter.

Since in every vvvv frame the entire patch gets analysed, it is not (easy) possible to ‘isolate’ a piece of your patch, and make that run 10 times and than continue.

The real if/than statements are a boolean (<,>,=,AND etc…) and than us a switch node for the Then.
See the patch I attached, hope it is becoming more clear now.

If you tell us what you want to do, I am sure, we can patch something that does that.

If a random value is equal to 3, than switch the text. (12.3 kB)

it will enrich your programming mind a lot, when you try to understand the control flow in vvvv. but if you have no time for that, just write dynamic plugins.

This may also help.