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 ?
block function return value
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- nickine9
- Posts: 147
- Joined: Fri Jan 06, 2017 4:14 am
Re: block function return value
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
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
- adavid7
- Posts: 120
- Joined: Fri Jul 04, 2014 7:32 pm
Re: block function return value
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.
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.
- nickine9
- Posts: 147
- Joined: Fri Jan 06, 2017 4:14 am
Re: block function return value
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
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
- adavid7
- Posts: 120
- Joined: Fri Jul 04, 2014 7:32 pm
Re: block function return value
Thanks, Nick!
That looks good. Where is a good place to offer feedback on the beta release?
.Andy
That looks good. Where is a good place to offer feedback on the beta release?
.Andy
- kevinjwalters
- Posts: 1025
- Joined: Sun Oct 01, 2017 3:15 pm
Re: block function return value
Their development team are active on this forum https://forum.makecode.com/
- adavid7
- Posts: 120
- Joined: Fri Jul 04, 2014 7:32 pm
Re: block function return value
Nick, is there also documentation on other changes that are in the beta version?
- nickine9
- Posts: 147
- Joined: Fri Jan 06, 2017 4:14 am
Re: block function return value
im afraid i don't know i stumbled across the beta version when i was doing things with a microbit and crickit.
nick
nick
Please be positive and constructive with your questions and comments.