Blocks with Parameters
Learn to pass parameters to the code blocks.
We'll cover the following
Passing parameters
The object that executes our block can pass a parameter. This depends on the implementation. Some objects do pass parameters to our blocks, while others don’t. It’s up to the programmer if they want to use this parameter or ignore it. So far, we’ve ignored this information but, technically, the parameter was always there. Let’s see how we can use it
In the case below, we have the object 24
with type integer.
Let’s write a program called “Piggy Bank,” which will accept 500 dollars every month and save that money. What we want to know is how much money it will have after 24 months.
Get hands-on with 1200+ tech skills courses.