# Getting maximum value of two variable in Code Block

In the code block i want to get the max value of the following variables:

• B3_Safe W [value by list(5) is: 650]
• B4_Safe W [value by list(5) is: 850]
850 should be the answer but i don’t know how to get this answer.
Can someone help me with this problem?

This probably isn’t the most elegant way to solve something like this but it should work.
Edit:

There’s actually a very simple function for that.

is this what you are looking for ?

List.MaximumItem(Math.Floor(Math.RandomList(10)*50));

http://dictionary.dynamobim.com/#/Core/List/Action/MaximumItem

I’m not looking for the highest number in one list, but the highest number between two list at the same level.

Like this?

I’ve tried your last example and it’s working

or like this:

`OUT = [max(i,j) for i,j in zip(IN[0], IN[1])]`

I found that Dynamo is incredibly flexible when it comes to list inputs as long as you’re being consistent, this is actually pretty simple.

Happy to help

This one is also working.

Thanks all you people.

You can actually tag a comment as solution so people with similar problems can immediately see how to solve it.

1 Like