block function return value

Microsoft's MakeCode platform for easy blocks-style programming

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
adavid7
 
Posts: 120
Joined: Fri Jul 04, 2014 7:32 pm

block function return value

Post by adavid7 »

It is nice that the FUNCTION block in MakeCode allows you to create your own functions and pass input parameters to the function.

But I don't see a way to specify a return value for a function that the calling block can use. It seems there should be a RETURN block that you could insert into a function you define, and optionally return a value!

Am I missing something ?

User avatar
nickine9
 
Posts: 147
Joined: Fri Jan 06, 2017 4:14 am

Re: block function return value

Post by nickine9 »

there is a beta version of the makdecode editor: https://makecode.microbit.org/beta#editor

and if you look in the functions section you will see two blocks

1) return

2) call function (this has rounded edges)

the help section has an example in the return section.

i've only tried a quick test with numbers so i don't know if you can return other datatype.

hope that helps

nick

User avatar
adavid7
 
Posts: 120
Joined: Fri Jul 04, 2014 7:32 pm

Re: block function return value

Post by adavid7 »

I should have mentioned that I am using the CPX, not micro:bit.

In makecode.adafruit.com, there is no such return block. (Nor can you create a boolean argument for the function, either.)

Does anyone know if there are updates in the works for the CPX version of makecode?

Thanks.

User avatar
nickine9
 
Posts: 147
Joined: Fri Jan 06, 2017 4:14 am

Re: block function return value

Post by nickine9 »

there is a bata version https://makecode.adafruit.com/beta/#editor

i haven't tried it but it does have a return block and possibly accepts boolean arguments but it doesn't have an extra round "call function`' block.

as its a beta im sure adfruit would welcome feedback.

nick

User avatar
adavid7
 
Posts: 120
Joined: Fri Jul 04, 2014 7:32 pm

Re: block function return value

Post by adavid7 »

Thanks, Nick!

That looks good. Where is a good place to offer feedback on the beta release?

.Andy

User avatar
kevinjwalters
 
Posts: 1025
Joined: Sun Oct 01, 2017 3:15 pm

Re: block function return value

Post by kevinjwalters »

Their development team are active on this forum https://forum.makecode.com/

User avatar
adavid7
 
Posts: 120
Joined: Fri Jul 04, 2014 7:32 pm

Re: block function return value

Post by adavid7 »

Nick, is there also documentation on other changes that are in the beta version?

User avatar
nickine9
 
Posts: 147
Joined: Fri Jan 06, 2017 4:14 am

Re: block function return value

Post by nickine9 »

im afraid i don't know i stumbled across the beta version when i was doing things with a microbit and crickit.

nick

Locked
Please be positive and constructive with your questions and comments.

Return to “MakeCode”