pxt
pxt copied to clipboard
Makecode, if then else block, false is dropped to the canvas
Makecode has block if else that generates code if .. else if .. else if .. else. This is useful block but it is full of troubles.
-
New
else ifsection can be added only at the end of the block (before the lastelse). It is not possible to insert newelse ifsection in the middle (+button is missing at innerelse ifparts) -
It is possible to delete any
else ifpart (-) button of the complex statement but there is no way to add it back later (see point 1) -
When
else ifparts are added (+) or deleted (-),falsevalue is drooped to the "desk", these values cannot be selected and deleted. Well, man has to exit editor and then reopen project, then it is possible to select and delete those disconnectedfalseblocks. And there could be many of them, it is not easy task to clean up the desk... It is possible that more then 1falseblock is dropped for eachelse ifsection... This is a BUG in the editor.
This block is useful but I have stopped to use it because it is buggy (point 3) and difficult to use (point 1).
Hint, Try to use use this block to write event handler for DPAD messages, 16 "if else" sections has to be added to handle 2 states of 8 buttons. that is a long statement. It is not easy to change order of conditions in such statement or insert new condition to the middle of the block... Some details are here https://kitronik.co.uk/blogs/resources/adding-bluetooth-remote-control-move-mini