Error: closeparen expected in code block

Hello, I have to inform all of you that I’m rather new to Dynamo but I’m trying to learn as much as I can right now. Currently, I have to do graduation project about calculating head loss in pipe using Dynamo to transfer data between Revit and Excel. The part that I’m stuck with is how to make ‘table: Allowance for friction loss in valves and threaded fitting’ in Dynamo and transfer the data back to the schedule in Revit.
so I tried to use a condition in code block but there’s a problem as state in this topic’s title


I’m not really too sure either if my code is the right one for this.
I imagine thing to go like this: If I have 4 inch pipe fitting then the parameter ‘Equivalent Length’ will store the data ‘14’ inside.

Thank you for your reply

This is how the table look like.
image

and this is my schedule in Revit.

Your code block is missing double quotes around the IF statement portion, but before the “;”

Hi,

  1. To check if a variable if equal to something in CodeBlock (and most of the languages actually), you have to use “==” not “=”. “=” is only used to affect a value to a variable.
  2. The only return statement you have in your CodeBlock is “return = 0”. I believe that in Imperative blocks, a variable first defined in the non-imperative part of the CodeBlock will still keep its value. You have to change the “return = 0” by “E = 0”, and add “return = E” at the end of the Imperative block.