VexCode IQ Blocks - Sub-routines?

Liking the new VexCode IQ block a lot!

Is it possible to create and call sub-routines with VexCode Blocks?

Not yet… but planned for a future update! You can use Events in the mean time to create reusable blocks of code.


You mean by using the “Broadcast message” block. Correct? Thanks for the tip!

1 Like

Correct. “Broadcast” will run the other stack of code at the same time, “Broadcast and Wait” will mimic a sub-routine/function/myblock by waiting until the called stack of code is completed before moving.


Just want to add a question: how can we pass parameters to the broadcast?

You would use variables like how @tfriez does with the distanceToMove variable in this post. The current value of the variable would be what is used in the broadcast.

Autonomous programming with VEXCode IQ Blocks


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