answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Savatey [412]
1 year ago
10

There is no hard-and-fast rule as to which is better, but what do you think? What kinds of circumstances would lead you to writi

ng a function versus using a loop?
Computers and Technology
1 answer:
sasho [114]1 year ago
4 0

Answer:

<u>Functions</u>

The piece of code that is used to perform the same operation at multiple places with different parameters.

<u>Loops</u>

The piece of code that is used to perform a task multiple times and continue until the loop ends.

<u>Explanation</u>

Both of these have different kind of circumstances to apply. For example.

  1. Function can perform a specific operation whenever we call. but when we use loop it will perform same task at multiple times at same place.
  2. Functions can be called at different places to perform operations multiple times but once loop called it cannot complete the operations until loop completed.
  3. Each time when we call the function we can change the values but in loop in iteration we cannot change the value of any variable until loop ends.

You might be interested in
add is a method that accepts two int arguments and returns their sum. Two int variables, euroSales and asiaSales, have already b
Oduvanchick [21]

Answer:

// here is code in Java.

// package

import java.util.*;

// class definition

class Main

{

   // method that return sum of two sale value

   public static int Add(int euroSales,int asiaSales)

   {

       // return the sum

       return euroSales+asiaSales;

   }

   //main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // variables

       int euroSales=100;

       int asiaSales=150;

       int eurasiaSales;

        // call the function

       eurasiaSales=Add(euroSales,asiaSales);

        // print the sum

       System.out.println("total sale is:"+eurasiaSales);

   }catch(Exception ex){

       return;}

}

}

Explanation:

Declare and initialize two variables "euroSales=100" and "asiaSales=150". Declare another variable eurasiaSales. Call the method Add() with euroSales and asiaSales as parameter. This method will add both the value and return the sum.This sum will be assigned to variable eurasiaSales.Then print the sum.

Output:

total sale is:250  

8 0
2 years ago
Dr. Apple wants to study a drug to manage diabetes in adolescents. The researcher plans to use an electronic informed consent (e
GarryVolchara [31]

Answer: Yes, the eIC could be used for assent.

Explanation:

Electronic informed consent (eIC) may be used for seeking, confirming and documenting informed consent.

5 0
1 year ago
Read 2 more answers
Write a single statement that will print the message "first is " followed by the value of first, and then a space, followed by "
nadezda [96]

Answer:

print("first is "+str(first)+" second = "+str(second))

Explanation:

The above written print statement is in python language.If first and second are strings then we need not to use str then we only have to write variable name.This statement prints the given in one line according to the question and it goes to new line after printing.

8 0
1 year ago
Analiza las relaciones y diferencias que encuentras entre las actitudes y los
Anarel [89]

Answer:Technology is the sum of techniques, skills, methods, and processes used in the production of goods or services or in the accomplishment of objectives, such as scientific investigation. Technology can be the knowledge of techniques, processes, and the like, or it ... An articulation of this philosophy could be found explicitly in Vannevar Bush's

4 0
1 year ago
Read 2 more answers
A(n) ______ consists of programs designed to make users more productive and/or assist them with personal tasks.
Vinil7 [7]

Answer:

Application Programs

Explanation:

Unlike the system software which interacts with the computer’s hardware to operate, the application software is designed purposely for the end users. They include programs like Word, browsers, and many other programs that we interact with every day to assist us achieve our daily tasks. We install application software according to what we want them to do for us.

3 0
1 year ago
Other questions:
  • Given a scanner reference variable named input that has been associated with an input source consisting of a sequence of strings
    14·2 answers
  • What does the hard disk drive do? It stores all of the information on a computer. It controls a computer’s operating system. It
    12·2 answers
  • Which perspective is usually used in process simulations?
    6·1 answer
  • The process of converting information, such as text, numbers, photos, or music, into digital data that can be manipulated by ele
    7·1 answer
  • What is the first step to apply the line and page breaks options to groups of paragraphs in a Word document?
    8·2 answers
  • For drivers under 21, the penalties for driving with an illegal BAL include _____.
    5·2 answers
  • Match common encryption algorithms and methods with the scenarios representing real-world business applications and requirements
    14·1 answer
  • When a program has several modules calling other modules, programmers often use a program ____, which operates similarly to an o
    5·1 answer
  • Assume that getPlayer2Move works as specified, regardless of what you wrote in part (a) . You must use getPlayer1Move and getPla
    14·1 answer
  • You are having a problem with your Windows computer that is isolated to a single graphics editing program that you use every day
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!