Skip to content

Blockly: Add unconditional return block #1926

@ChrMaass

Description

@ChrMaass

Is your feature request related to a problem? Please describe.
Currently, Blockly in the JavaScript adapter only offers a return block with a condition (e.g. if ... return).
If you want to return a value at an arbitrary point in the code, you always have to set the condition to true, which leads to unnecessarily nested and visually messy blocks.

Describe the solution you'd like
Please add a new Blockly block like return <value> without any condition.
This would directly correspond to a plain return <value>; in JavaScript.
The current conditional return block can stay, but it should be complemented by this cleaner alternative.

Describe alternatives you've considered
The only workaround is using true as the condition. While it works, it makes the Blockly code less readable and clutters the logic unnecessarily.

Additional context
Especially when working with more complex functions and multiple return paths, an unconditional return block would help keep the structure clean and improve code clarity.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions