# How do I make this conditional statment code block work?

**URL:** <https://forum.dynamobim.com/t/how-do-i-make-this-conditional-statment-code-block-work/7902>\
**Category:** Lists-Logic\
**Created:** [December 1, 2016, 6:06pm UTC](https://forum.dynamobim.com/t/how-do-i-make-this-conditional-statment-code-block-work/7902 "2016-12-01T18:06:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rghassemi](https://avatars.discourse-cdn.com/v4/letter/r/e79b87/32.png) [@rghassemi](https://forum.dynamobim.com/u/rghassemi)\
**Post date:** [December 1, 2016, 6:06pm UTC](https://forum.dynamobim.com/t/how-do-i-make-this-conditional-statment-code-block-work/7902/1 "2016-12-01T18:06:01Z")

</div>

Hi, I have been trying to have create code block in dynamo that takes 2 inputs (evaluates input 1 to see if it is greater than 8 or not; if greater than 8 then I want the software to apply a certain formula…if not want to do something else). But I seem to been having difficulty having the function run…it give me a null response…could you please help…please see below:

def FunctionName (input1,input2)  
{  
S=(input1\>8? 1.5\*(input1-8)_(input2)+(8_input2):input1\*input2);  
return=s;  
};  
r=FunctionName(11,2);

---

<div class="post-metadata">

**Author:** ![Thomas\_Mahon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thomas_mahon/32/64209_2.png) [@Thomas\_Mahon](https://forum.dynamobim.com/u/Thomas_Mahon)\
**Post date:** [December 1, 2016, 6:25pm UTC](https://forum.dynamobim.com/t/how-do-i-make-this-conditional-statment-code-block-work/7902/2 "2016-12-01T18:25:29Z")

</div>

There are a number of problems:

1. You can’t use a ternary operator in associative DesignScript blocks. You need to declare a Imperative block instead. This applies to any if statement

2. Ternary operators currently don’t work in Imperative definitions anyway, the bug has been reported on Dynamo GitHub, so you need to use an if statement block instead

3. You have typo’s. ‘`s`’ and ‘`S`’ are two different objects

4. More typo’s: `input2` and `8input2`

5. missing a binary operator here (i assume you meant to multiply hence the typo of ‘8’?): `(input1-8)(input2)`

Check out the Dynamo DesignScript intro [here](https://forum.dynamobim.com/t/dynamo-designscript-learning-resources/6359)

---

<div class="post-metadata">

**Author:** ![rghassemi](https://avatars.discourse-cdn.com/v4/letter/r/e79b87/32.png) [@rghassemi](https://forum.dynamobim.com/u/rghassemi)\
**Post date:** [December 1, 2016, 6:54pm UTC](https://forum.dynamobim.com/t/how-do-i-make-this-conditional-statment-code-block-work/7902/3 "2016-12-01T18:54:05Z")

</div>

Thanks Thomas it was very helpful and solved the bug!!! I appreciate the help.
