Skip to main content
Best answer by Werner_E

Its not clear to me what you actually want and what you mean by "instead of the if-function".

What you has encircled in red is a boolean expression - its either 0 (=false) or 1 (=true). Do you really want your k.c to be 0 or 1 only?

Actually you already use the encircled expression in your calculation, but of course you have to tell Prime what to do if the expression is not in between the two values and this can be done with if statements or using the if-function, if you feel that the if statements take up to much space:

Werner_E_0-1678453881500.png

A tricky way to achieve the same effect is using the min and max functions:

Werner_E_1-1678453969133.png

 

 

1 reply

Werner_E25-Diamond IAnswer
25-Diamond I
March 10, 2023

Its not clear to me what you actually want and what you mean by "instead of the if-function".

What you has encircled in red is a boolean expression - its either 0 (=false) or 1 (=true). Do you really want your k.c to be 0 or 1 only?

Actually you already use the encircled expression in your calculation, but of course you have to tell Prime what to do if the expression is not in between the two values and this can be done with if statements or using the if-function, if you feel that the if statements take up to much space:

Werner_E_0-1678453881500.png

A tricky way to achieve the same effect is using the min and max functions:

Werner_E_1-1678453969133.png

 

 

8-Gravel
March 10, 2023

I want kc to be equal to the equation but not less than 0.35 and not more than 0.76, but the result gives me zero, how I can make it give the same result as the (if function)?

25-Diamond I
March 10, 2023

See my suggestions above.

 

Again, what you encircled is a Boolean expression and so its value is either 0 or 1. You can use Boolean expression in if-functions, if-statements, while-loops, ... But the expression itself will always be either 0 or 1, depending on if its false or true.

 

Here are some other variants

Werner_E_0-1678454649457.png

Werner_E_1-1678454692209.png

And if you need it more than once to limit a variable in between two values, you may consider using a little utility function

Werner_E_2-1678454855001.png