-1 becomes false when passed as an input into a procedure

I used an input parameter with a procedure for the first time the other day. I kept getting error messages in the procedure “can’t add [100] to [FALSE]”.

I eventually worked out that while I was calling the procedure with the input “-1”, the procedure was receiving it as “FALSE”. I replaced the input with a global variable and it all worked fine.

I guess this might be something to do with the fact that there is no initialise statement and so the procedure has to guess what sort of variable the input is?

All depends what you are doing, you could use the logic blocks true and false instead, or maths blocks to ensure you are working with numbers and not boolean values?

Please show your relevant blocks,
if relevant, your data or lists,
screenshots of the Designer screen or app in action,
so we can see what you are trying to do…

Right Click in Blocks Editor and select “Download Blocks as Image”
for the best image of your blocks.

Unfortunately I don’t have the original code as I amended it. I’ve just tried to recreate it and it’s all working properly now.

I did have an issue that forced me to restart my browser (if I used cleanup blocks it instantly duplicated all my blocks and then added in a whole load from another project), so I suspect it may have been caused by a corrupt browser rather than any AI2 problem.

I’ll let you know if it happens again.

You can ensure the value sent is a number:

Sounds like a leaky Backpack.
Best to keep it empty when not in use.


Checked the backpack - found it full of a load of stuff I don’t remember putting there. I was also having problems with right-click though, and may have copied all to the backpack several times without realising it, possibly overloading it (there were several thousand blocks in there).

All cleared now - thanks for the heads up.