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.

4 Likes

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.

3 Likes

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

2 Likes

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