Skip to content

power operator block a^b#3462

Open
AeroKoder wants to merge 1 commit into
scratchfoundation:developfrom
AeroKoder:operator_power
Open

power operator block a^b#3462
AeroKoder wants to merge 1 commit into
scratchfoundation:developfrom
AeroKoder:operator_power

Conversation

@AeroKoder

Copy link
Copy Markdown

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 scratchfoundation/scratch-editor#444

Test Coverage

Tests are in the scratchfoundation/scratch-editor#444

@redspacecat

Copy link
Copy Markdown

ah, a new PR was made

@AeroKoder

This comment was marked as off-topic.

@rosics-code

Copy link
Copy Markdown

@AeroKoder you would have to edit the 23,000 line translation thing in this PR too

@Aldmors

Aldmors commented Jun 3, 2026

Copy link
Copy Markdown

Looking at the scratch forum and then here with the thought that maybe soon a certain period of the history of the "13-year Struggle for Power operation" will be close

@AeroKoder

Copy link
Copy Markdown
Author

Looking at the scratch forum and then here with the thought that maybe soon a certain period of the history of the "13-year Struggle for Power operation" will be close

Yep, hopefully someone merges this soon.
@cwillisf

@rosics-code

Copy link
Copy Markdown

Looking at the scratch forum and then here with the thought that maybe soon a certain period of the history of the "13-year Struggle for Power operation" will be close

Yep, hopefully someone merges this soon.

@cwillisf

They won't, you have to use feat: or something and they wouldn't just add features off the fly

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