microsoft / microsoft/pxt-microbit

Boolean variable should be made consistent in look and behaviour

Open
#2,451 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Blocks
Dominant language
TypeScript
Stars
804
Forks
721
Avg merge
2d 9h
Merged PRs (30d)
2

Description

** Is your feature request related to a problem? Please describe.
The look of boolean variables are not consistent. For example condition fields are pointy ended boxes which fit the defined 'true' and 'false' constants. This can be confusing to the user. The current situation and a proposed solution is outlined below.

**The problem and a possible solution
When a variable is assigned to a boolean value, as in the 'on start' function, the editor clearly knows that it is a boolean. This is reflected (as illustrated below) in the errors given when trying to set it to a number or as a parameter in the 'show number' function. However, the user is not given this feedback. For example, the boolean variable (roundy ends) can be inserted as a condition in the 'if statement' despite the fact that a boolean value (and corresponding field) is shown as a pointy ended box (see next image).
boolean1

Pointy condition field.
boolean3

The solution is to make boolean variables the correct shape to fit the boolean field, as below
boolean3 revised

The make variable panel needs changing otherwise it is inconsistent (as below). If 'bouncing' is a boolean then obviously it cannot be set to a number or changed by 1.
boolean2

The revised (and consistent) variables panel would look like this.
boolean make variable

Boolean variable are now consistent in 'fitting' boolean fields and not fitting non-boolean fields. As shown below, the user can easily see that the boolean variable 'bouncing' can be used as a condition.
boolean in use

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 locating the blocks editor's boolean variable rendering and the make-variable panel; no files or tests are identified in the issue. Done means boolean variables use the boolean shape consistently, fit condition fields, and are excluded from numeric operations and assignments.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
design, frontend
Issue type
Feature
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.