Visual programming tools like Dynamo or Grasshopper are designed with premade basic nodes/components that allow you to do stuff easily…like, for example, an “Addition” node lets you plug two numbers into it and adds them for you. Most visual programming tools also allow you to do more complex things using various programming languages (Python, C#, Ruby, etc…) typically typed up within a blank node that they provide for coding. In the case of Dynamo, the “CodeBlock” node is simply a vessel within which you can write out something more complex (or, in this case, simple) with DesignScript programming language developed by Autodesk. DesignScript IS the programming language of Dynamo…so its baked in.
If you find my switch expression confusing, you’re not alone; I do also because I’m not a programmer and why it works is a mystery to me. In this case, the question mark just accepts the boolean toggle and switches the output from a to b.
@rnarracci I’ve coded a complete applciaiton with Unity 3D bolt visual scripting tool. In bolt you can control the code flow direction where here in dynamo it 's still very confusing to me.
I think it would be easier to think of this as switching the inputs that go into a single Data.ExportToExcel node instead of branching off to a duplicate of the same node. I’m assuming you’re only trying to have the user control one of the inputs, but not all 7 of them?
This is DesignScript shorthand for writing a basic if/else statement. In this specific case, the Code Block has three variables defined (x, a, and b). It says:
x ? a : b
The equivalent if you were to write a full if/else statement would be:
if (x)
a
else
b
In the example, it’s a pretty basic check because the variable ‘x’ is a boolean (true/false node). But you can put whatever you need in that first part (called the conditional). Maybe you’d want to check if ‘x’ is a certain number, like this:
x == 5 ? “x is equal to 5” : “x is not equal to 5”
I think you’re probably already more knowledgeable that me on the subject! Not sure what you mean by flow direction but I have noticed that GH and DYN are averse to recursiveness and one has to take care about avoiding feedback loops that blow your stuff up. Good luck.