Imperative Function inside Imperative function?

Hello everybody!
I am trying to something like that

And i don’t know if its a possible option or if it’s something that i can’t do.
When i run it, it gives me this error log:
Do you have any suggestions?
Many thanks
Elisabetta

Index was outside the bounds of the array.

at ProtoCore.DSASM.Executive.GetProcedureNode(Int32 blockId, Int32 classIndex, Int32 functionIndex)
at ProtoCore.DSASM.Executive.UpdateMethodDependencyGraph(Int32 entry, Int32 procIndex, Int32 classIndex)
at ProtoCore.DSASM.Executive.SetupExecutive(Int32 exeblock, Int32 entry)
at ProtoCore.DSASM.Executive.Execute(Int32 exeblock, Int32 entry, Language language)
at ProtoCore.DSASM.Executive.Execute(Int32 exeblock, Int32 entry, List1 breakpoints, Language language) at ProtoCore.DSASM.Executive.BounceUsingExecutive(Executive executive, Int32 exeblock, Int32 entry, StackFrame stackFrame, Int32 locals, Boolean fepRun, Executive exec, List1 breakpoints)
at ProtoScript.Runners.ProtoScriptRunner.ExecuteLive(Core core, RuntimeCore runtimeCore)
at ProtoScript.Runners.LiveRunner.Execute(Boolean isCodeCompiled)
at ProtoScript.Runners.LiveRunner.ApplyUpdate()
at ProtoScript.Runners.LiveRunner.CompileAndExecuteForDeltaExecution(List`1 astList)
at ProtoScript.Runners.LiveRunner.SynchronizeInternal(GraphSyncData syncData)
at ProtoScript.Runners.LiveRunner.UpdateGraph(GraphSyncData syncData)
at Dynamo.Scheduler.UpdateGraphAsyncTask.HandleTaskExecutionCore()
at Dynamo.Scheduler.AsyncTask.Execute()

You cant declare an imperative block inside an imperative block. What you need to do is either:

  1. Separate the inner imperative block into its own def, then call it in the body of the FunctionGA def

or

  1. Get rid of the second imperative block declaration, so its body becomes part of the FunctionGA def
2 Likes

thanks! Actually i notice that i already had the answer :slight_smile: on a precedent topic!

Continuing the discussion from Python, Excel and Codeblocks:
Many Thanks