Smaller then, larger then in a code block


#1

Morning all,

I want to evaluate if a number is in between 2 in a code block. I can 2 it with a few nodes but i’d like the code block way
I used (x?y:z) for a single IF but is there a syntax for in between?

Thanks guys


#2


This should work.


#3

Morning Paul,
y didnt ask my question right, sorry about that.

I have a value, if it’s smaller then 75 use 75, if it’s greater then 400 use 400. If not use the value.
I am now using 2 formulas to evaluate it


#4

It’s fine, formulating these things can be difficult.
So you do you want it like this:


#5

Here’s what im using right now

//Total Number of Rooms that failed the test
l1 = Count(l0);
//Temporary ListViewHeight
hTemp = l1 * 21;
//ListViewheightEvaluationMimimum
hmin = hTemp < 75;
hminTemp = (hmin?75:hTemp);
//ListViewheightEvaluationMaximum
hmax = hminTemp > 400;
h = (hmax?400:hminTemp);


#6

Well…
I have no idea what’s going on there, all I can tell you is what my code does.
I don’t know how to change things with Dynamo when it comes to view height, I’d say that’s a different question for a different topic.


#7

Regardless of what is the end use of the values, @PauLtus 's method gives the output you said you are looking for :slight_smile:
Broken down for better understanding:

Cheers


#8

Git it
Thanks guys :slight_smile: