Function parameters in general

This photo comes from this video

I’m just curious why use function parameters at all?
Why not avoid the function to begin with and just place the concatenation, as in the screen shot I provided, into the label to save code?

That’s not a great example of using a function to simplify code. I’d say it’s fine either way.

1 Like

What is a good argument for function parameters?

The most obvious answer to me is that a function should handle repetitive code by reducing the number of blocks needed.

So if I find myself re-using a set of blocks, I might make it into a function. Or if I need to run those blocks over and over with different input values, I might make it into a function.

Not the function itself, the parameters.

What is the significance of having them?

Parameters allow you to run the same function multiple times with different inputs.

Let’s say I wanted to take an image url stored in Cloudinary, convert it so that the image is cropped and scaled and set to a lower file size as well, and then share that url in an email message using an API to send it. I could make the url the parameter of the function that does all of that and for any image I wanted to run through that process, I could just call the function block with that image’s url.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.