microsoft / microsoft/pxt

Ability to set default values for arrays in functions

Open
#9,808 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

https://makecode.com/playground#basic-array-default-values

I want to request the ability to set default values for arrays in user-defined functions, for example to specify an array of numbers [1, 2, 3] rather than whatever [0, 1]

image

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

Reproduce the behavior in the linked MakeCode playground and inspect how user-defined function parameters are represented and compiled. Determine where array default values are restricted, then add coverage showing that a parameter can default to [1, 2, 3] rather than [0, 1]. Done means the example works consistently in the relevant editor and generated code.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.