What are the benefits of writing functions that use parameters and return List 2 please and explain what is return

Answers

Answer 1

Answer and explanation:

There are many benefits of writing functions that use parameters and return. Some of them are:

1. Flexibility: With functions having parameters, several values of the parameters can be used at invocation time thereby making the application flexible. For example, given the following function in Java.

public void showName(String name){

   System.out.println("Your name is " + name);

}

To call this method (function), the programmer could use various values for the name parameter used in the function like so:

showName("John");

showName("Doe");

If the function didn't have a parameter, it is possible it will only print a hardcoded name every time the function is called.

2. Scope Control: When a function is allowed to return a value, it helps to work around scope issues since variables declared within a function are limited to that function and do not exist outside the function. This means that the values of these variables cannot be used anywhere else outside the function in which they are being declared. However, if the function returns a value, the value can be used anywhere else in the program.

For example:

public String getDouble(int x){

   int y = x * 2

   return y;

}

The function above returns twice the value of the argument supplied to it. Since the integer variable y is declared within the function, it's value cannot be used outside the function. However, since the value is being returned by the function, it could be used anywhere the function is being called. Thanks to the return keyword.


Related Questions

ICT 10
Research on other forms of Operating systems used in smartphones and give a description for each.​

Answers

uSE THE ANSWER BELOWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW

what is two examples of software and hardware?​

Answers

Answer:

Hardware Software

If hardware is damaged, it is replaced with new one. If software is damaged, its backup copy can be reinstalled.

Ex: Keyboard, Mouse, Monitor, Printer, CPU, Hard disk, RAM, ROM etc. Ex: Ms Word, Excel, Power Point, Photoshop, MySQL etc.

Explanation:

Answer:

hardware= key board ,mouse

software =excel,power point.

Babbage’s punch cards, which used numbers from 0 to 9. Digital or analog.

Answers

Answer:

Analog

Explanation:

yuh

Answer:

Your answer would be

1. Digital

2. Analog

3. Digital

4. Analog

5. Analog

Explanation:

Edge 2022

Approximately how many tweets are posted on Twitter each day? 500 500 thousand 500 million 500 billion

Answers

Answer:

around 500 million

Explanation:

On December 9, 1698, computer inventor Douglas Engelbart demonstrated many new computing technologies, including the computer mouse. His demonstration was so important that it became known as “The Mother of All Demos”. It would be at least two decades before some of the technologies he demonstrated saw widespread use, but all of them are used by people today. Here is a list fo some of Engelbart’s technologies. Which ones do you use today? The computer mouse, video conferencing hypertext links, word processing, or collaborative real-time editing

Answers

Answer:

all of them

Explanation:

Answer: All trust guy above

Explanation:

.

Other Questions
These mechanoreceptors would be activated if your little brother poked you in the arm while you were trying to nap. How many atoms are there in 3.3 moles of strontium? Please help!!Does the amount energy from food eaten by each organism equal the amount of energy used but each organism? How did the climate of the South, as opposed to the North, contribute to the widespread use of slavery?The topography of the South was similar to the conditions in Africa.B)The climate of the North was too cold for the slave population to thrive.Tobacco, cotton, and rice could be grown in the temperate climate of theSouth.D)It was too hot in the South for factory work, so agriculture was the primaryactivity Can you please answer this !!PLEASE HELP!!!!!! x=___ The beakers in the picture above are labeled according to the ionic solutions they contain. What metal or metals could replace copper in the copper(II) nitrate solution? What is the charge of an electron?A-negative B-neutral C-positiveD-none of these what is the radius if the circumference is 1.0 which of the following is export item from Nepal?a. cementb. cashew nutsc. pashminad. palm oil Any permanent change in a gene is called a Whats the decimal as a persent Which statement is false?A. Every rational number is also an integer.B. No rational number is irrational.C. Every integer is also a rational number.D. Every irrational number is also real. During January, Year 2, Geo entered into the following transactions: Paid $728 on account for utilities that were used during December, Year 1. Purchased $488 of supplies for cash. Signed a rental agreement for office space and paid $6,100 in advance for six months of rent beginning February 1, Year 2. Purchased $21,000 of new equipment, signing a promissory note. Provided $32,500 of services. $16,000 was received in cash and $16,500 was provided on credit. Paid workers $7,400 for work done in January. Required: Prepare journal entries for each of the following January activities, and post results to the relevant T-accounts. Compute the ending balance of each T-account. Beginning balances have been entered. what is this correct answer? Nathan's family took a road trip to Mount Rushmore. Nathan fell asleep 9% of theway through the trip. If Nathan fell asleep after they had travelled 54 miles, what wasthe total length of the trip? what is the meaning of contents of curriculum Evaluate the function. g(x) = 3x^2 2x + 5 Find f(2) defintion of the word free Okay, Do yall have any theories about VandaVision, I CANNOT WAIT until Friday!!!!!My theory is that When Thanos wiped half of the existence out, that included Wanda, but not vis since he took the mind stone offa paul Bettanys head n left em there, he turned gray, so she vanished, and then used quantum physics to create a dang Time wall basically making a quantum tunnel into her universe where Vis was alive. She was the ONLY avenger who had the power to defeat Thanos without dying, the only thing that kept her from doing it was her beloved Vision (and the fact Thanos wielded the time stone) so she used her power, while in the quantum realm, to make an alternate dimension where she was actually with Vis. so Liz Olsen basically created a tunnel to a new universe and Geraldine was from the future. That's my theory. If you have any, please put them below, Your reward is rather high. THANKKKKKS, MY FELLLOOOW MARVELL FFFANNNGGIIRLLLSSANDBOYS (And if ur nonbinary, ur awesome too, I didn't forget) Please stay awesome, wear a mask, and May the force be with you!!!! *MARVEL SPOILERS*