Local var

VeGaS

  • Posts: 14
Sometimes you need to make intermediate calculations, which are conveniently stored in a local variable inside a function. How this is done using standard blocks?
And then I found only the creation of an attribute - it's not exactly what you need.

coleislazy

  • *
  • Posts: 2607
If you want to use only blocks, you'll have to use regular attribute. Just make sure you reset them to defaults before or after you use them, so you don't have unexpected behavior.

Actually, you could probably make a custom block and add extra variables that won't be necessary for input and manipulate those. They will be local variables, but you'll have to pass in a value when you use the custom blocks (but it can be zero or whatever).

If you need a quick variable for calculations and don't mind using code blocks, you can use AS3 syntax to code it.

captaincomic

  • *
  • Posts: 6108
Quote
If you want to use only blocks, you'll have to use regular attribute
and make it hidden.

I think of it like this:
hidden attribute = local variable
non-hidden attribute = parameter of behavior