Skip to content

power operator block a^b#3431

Open
AeroKoder wants to merge 1 commit intoscratchfoundation:developfrom
AeroKoder:operator_power
Open

power operator block a^b#3431
AeroKoder wants to merge 1 commit intoscratchfoundation:developfrom
AeroKoder:operator_power

Conversation

@AeroKoder
Copy link

@AeroKoder AeroKoder commented Feb 12, 2026

Resolves

scratchfoundation/scratch-editor#426

Proposed Changes

Add a new block to the Operator category to raise a given number to a power of another given number.

Reason for Changes

This is a highly requested block by many Scratchers and Scratch Team members (I have with some [1,2], and they agree that it should exist in Scratch). There also aren't any accurate workarounds, besides ones that are crazy inefficient, making this block even more important to have.

It has been discussed in multiple topics and issues, and they always end up with tons of upvotes and supports.

The one thing I would like to discuss is whether, zero to the power of zero, should return 1 or NaN. Currently, it returns 1, as that is what the native JavaScript operator returns. This might confuse younger Scratchers, but then again, I don't know if NaN is such a good idea either, since it acts as zero in scratch, making some math equations with the power operator return an incorrect result. Discuss this in the scratch-editor PR

Test Coverage

Tests are in the scratch-editor PR

@github-actions
Copy link

github-actions bot commented Feb 12, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@AeroKoder

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments