Workaround to avoid a duplicate expression?

Is there a workaround so I don't have to get the value from the reverseColorTable dictionary twice?

I wanted to set up a local variable to capture the expression's result.

I tried creating another local, but since it references the "color" variable, it was giving me an error. I've also tried a local nested within the "color" local and I get a similar issue.

I've also thought of making a procedure, but while that simplifies the code and makes it more readable, it doesn't solve the problem of repulling that key more than once.

{I'm trying to do this without a global}

two methods:

1 Like

I tried the nested approach and it worked! Thank you! I swear I got a "variable not in scope" error before. Maybe I had mixed scopes some how.

Also, additional thanks for helping me understand the DO/Result block. I've been struggling with block connectors not fitting together and now I see how.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.