by ryr
Jul 17, 2013
Dear all,
How can make an if statement in grasshopper, for example.
If input values is x then,
x = 1 then y = 332
x = 2 then y = 32
x = 3 then y = 4423
where input x and output y has no mathematical relations.
Thanks in advance.
R.
If y is just a list of predeterminated values :
you could create a non multiline panel filled with your value...
X is now the index of your list,
y is the item,
Use a list item to find y according to x.
Key Value search using Sylvains logic should work.
If you really want to create an If statement using code, then it would look like this:
If(x=1, 332, If(x=2, 32, If(x=3, 4423)))
Which is pretty horrific.
--
David Rutten
david@mcneel.com
Tirol, Austria
Hello,
I have a question, can this work also for the ranges of numbers ? For exampleIf x c {0,5; 1} then y = 1 ?
Kind regards.
Mar 26, 2014
Cancel
Sylvain Usai
If y is just a list of predeterminated values :
you could create a non multiline panel filled with your value...
X is now the index of your list,
y is the item,
Use a list item to find y according to x.
Jul 17, 2013
David Rutten
Key Value search using Sylvains logic should work.
If you really want to create an If statement using code, then it would look like this:
Which is pretty horrific.
--
David Rutten
david@mcneel.com
Tirol, Austria
Jul 17, 2013
Aleksander Łapiński
Hello,
I have a question, can this work also for the ranges of numbers ? For example
If x c {0,5; 1} then y = 1 ?
Kind regards.
Mar 26, 2014