Skip to content

power operator block a^b#444

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

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

Conversation

@AeroKoder
Copy link

@AeroKoder AeroKoder commented Feb 12, 2026

See also scratchfoundation/scratch-blocks#3431

Resolves

#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.

Test Coverage

Tested locally:
scratch-power-block-tested-locally

@github-actions
Copy link
Contributor

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.

@redspacecat
Copy link

this would be great to add!
please merge this PR, scratch team.

@Jab11n
Copy link

Jab11n commented Feb 13, 2026

This has been highly requested on the Scratch Forums for years. It would be a major long-awaited addition to the Scratch editor should it be merged. In fact, it was first suggested in 2013. Please merge it!

@Oren-Lindsey
Copy link

This is a great addition, I think a lot of people would appreciate it.

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.

4 participants

Comments