Page 1 of 1

Nested IF blocks

Posted: Thursday 23 February 2017 15:12
by micha_pr
Hi,

if nested "If" blocks do not work at all - is it possible to disable this option in Blockly?
(we didn't know it before - and it have taken long time while we understood this issue)

I think a lot of users can try to use it - and can not understand it, what happen ;)

(BTW: is this a "missing feature" - or by design?)

Re: Nested IF blocks

Posted: Thursday 23 February 2017 16:39
by rotero
Hi,

I also found out nested Blockly scipts are not working! Very annoying!

What I think is also different with Blockly:
Normally if you use an IF DO / ELSE IF DO statement, the ELSE IF is only checked if the first IF is not true.
Blockly works different.

Example:
If all variables are 0 and the time is 17:00, all variables will be set to 1 with this script:
IF time > 13:00
DO set A = 1
ELSE IF time > 13:30
DO set B = 1
ELSE IF time > 14:00
DO set C = 1
ELSE IF time > 15:00
DO set D = 1

I always thought that only one DO can be executed in these kind of statements.

Regards,
Rob

Re: Nested IF blocks

Posted: Thursday 23 February 2017 17:24
by micha_pr
Right. You should use the full condition again in the "else" if.

It is really not an ELSE IF ... but an "OR IF"