microsoft / microsoft/pxt

Makecode, if then else block, false is dropped to the canvas

Open
#10,328 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.3k
Forks
641
Avg merge
12h 4m
Merged PRs (30d)
57

Description

Makecode has block if else that generates code if .. else if .. else if .. else. This is useful block but it is full of troubles.

  1. New else if section can be added only at the end of the block (before the last else). It is not possible to insert new else if section in the middle (+ button is missing at inner else if parts)

  2. It is possible to delete any else if part (-) button of the complex statement but there is no way to add it back later (see point 1)

  3. When else if parts are added (+) or deleted (-), false value 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 disconnected false blocks. And there could be many of them, it is not easy task to clean up the desk... It is possible that more then 1 false block is dropped for each else if section... 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the MakeCode editor's if/else block behavior described here, especially adding or removing inner else-if sections. Trace the editor path that handles those block mutations; no file or test is identified in the issue. Done means inner else-if sections can be inserted and removed without dropping disconnected false blocks.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.