Question

In scratch I am building a recursive routine that I want to avoid using global variables with. At the moment I am having some issues with parameter passing and need to know whether they are passed to subroutines as ByVal or ByRef and can you change the method?

Was it helpful?

Solution

In Scratch routine variables can't be returned and there is no way to set them to a different value, so that is irrelevant.

The routine block allows you to name an input variable, but not to then use it in a set block, and there's no return block at all.

Routine block

You can't change it in Scratch, but you can I believe in byob.

OTHER TIPS

There is a way around the problem boisvert is showing in the other anwer. Drag number1 to where 0 is and it will set testvar to number1 for other sprites to use.

You still can't modify the original number1 though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top