How made a 'function' in App Inventor?

Hello Amorosik

In App Inventor that's a Procedure. On your selected Procedure Block, click the little blue cog button to define input parameters.

Edit: I haven't shown how to use a Procedure Block for your example since it looks like a homework question. If you want help with something you want your App to do but your efforts have failed, show us your Blocks.

There are a lot of free tutorials by MIT. See the links to them on my site, plus a collection of tips and tricks and example code snippets.