blockpy-edu / blockpy

Blockly that's more Python than JavaScript, powered with Skulpt
Apache License 2.0
391 stars 130 forks source link

No output handle in a block calling a function #27

Closed suiato closed 3 years ago

suiato commented 7 years ago

When I define a function in Functions with a return block and call it, the calling block has no output handle. How can I print the returned value? (I use a cloned version running on a PC.)

suiato commented 7 years ago

I closed the issue because I found the call block had an output handle when I edited the python code. But, it's still a problem that the call block doesn't have an output handle without editing the python code.

An example I ran was:

def test(x):  return round(x) print(test(1.5))

acbart commented 7 years ago

You're right, this needs to happen dynamically. It should be possible to determine, statically, if a function has a return block nested inside - and if so, then it should have a left output.

acbart commented 3 years ago

Static analysis is hard. Instead, BlockMirror just allows you to right click and switch between statement and expression modes for a Call block. https://github.com/blockpy-edu/BlockMirror/