Create Function by using "&&"

Greeting. I am now working a task: replacing with new values depending on their original values.

As the picture below, I have two conditions:

  1. Change those equal or less 25 to 40
  2. Change those more than 25 but less then 32 to 50

I have succeeded into the first condition. However, I met difficulty in the second one. I made a research and found “&&” node is good for meeting two scenario. However “&&” is a bool output which cant be used in “ReplacebyCondition” node.

It would be great if you can provide me a solution. Thanks.

@TCKEAHY It would be much simpler to just use a nested if in a Code Block!

condition ? value if true : value if false


x>25 && x<=32 ? 50:
	x<=25 ? 40:
		"Not defined";

Thanks @AmolShah . It works.

I can see the potential of Code Block. There is a similar case that I have to repeat with a lot of same nude and I fail to use “list.create” as the “ReplaceByCondition” doesn’t support getting index. Could you teach me how to simply it by using Code Block?

1 Like

@TCKEAHY Try this:

"Not a match";

@AmolShah Thank you very much.

Last question, where could I learn to use those script structure which correspond to Dynamo Node? (It is a shame that Dynamo doesn’t provide it)
Such as: if Node = condition ? value if true : value if false

It would be helpful since I can study first before asking on forum.

1 Like

@TCKEAHY There are quite a few resources on DesignScript. Search through the forum and you will uncover it. To start with you can look into these: