If statement

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.

 

  • up

    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.

    1
    • up

      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:

      If(x=1, 332, If(x=2, 32, If(x=3, 4423)))

      Which is pretty horrific.

      --

      David Rutten

      david@mcneel.com

      Tirol, Austria

      11
    • up

      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.