1answer.
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
Basile [38]
2 years ago
11

How I to turn this ''loop while'' in ''loop for''? var i = 0; while (i < 20) { var lineY = 20 + (i * 20); line(0, lineY, 400,

lineY); i++; }
Computers and Technology
1 answer:
Fudgin [204]2 years ago
5 0

Answer:

for(i = 0; i<20;i++){

lineY = 20 + (i * 20);

line(0, lineY, 400, lineY) }

Explanation:

First declare and initialize the variable i. You have not specified the data type of i so if the data type of i is integer i.e. int then you should declare i variable in the for loop as for(int i = 0; i<20;i++)

So the given while loop has a variable i which is initialized to 0. Then while(i<20) means that while loop executes until the value of i exceeds 20. If this while condition is true then the two statements inside its body will execute. The two statements are: lineY = 20 + (i * 20);

line(0, lineY, 400, lineY);

The value of i ins incremented after each iteration i.e. i++

So while loop has the following syntax"

1) initialization;  ---->  i = 0

2) while(condition) {  ----> i<20

3) loop body ----->  lineY = 20 + (i * 20); line(0, lineY, 400, lineY);

4) increment or decrement loop variable  } ----> i++

For loop has the following syntax:

for( initialization of loop variable ; condition; decrement/increment loop variable)  {

loop body }

Here:

initialization  ---->  i = 0

condition        ----> i<20

loop body     -----> lineY = 20 + (i * 20); line(0, lineY, 400, lineY);

increment or decrement loop variable  ---->  i++

You might be interested in
You Could Never Size Me UP! Been Doing This Sh*t A Long ⏱time
SVETLANKA909090 [29]

Answer:

Have a nice day :) God Bless!

Explanation:

4 0
2 years ago
Cual
iVinArrow [24]

Answer:

no lo sé

Explanation:

Eso es depende de lo que vayas a imprimír

8 0
3 years ago
The IBM nine-track tapes that became the industry standard for storage for three decades had several sizes , the most common bei
sergey [27]

Answer:

5 MB.

Explanation:

1 foot = 12 inches

2400/9=266.66 feet per track

1 track excluding, remaining 8 track =2400 - 266.66 = 2133.33 feet

so, space available to store data = 2133.33 feet

now, 2133.33 feet = 25600 inches

total data that can be stored = 25600 * 1600 = 40960000 bits

= 46080000/8 = 5120000 Bytes

= 5120000/1000000 = 5.12 MB = 5 MB (approx.)

3 0
3 years ago
National ISPs usually offer fewer services and have a smaller technical support staff than regional ISPs.
choli [55]

Answer:

um not sure

Explanation:

5 0
2 years ago
Is there a way I can put an already made sound that i created over an already made video
lys-0071 [83]
If you're using an apple product to do video editing, then iMovie is probably the best way to do that.

If you're on Windows and you're looking for a free video editing website, I'd suggest WeVideo. Although WeVideo does add watermarks to your videos, editing is pretty easy when using it.
6 0
3 years ago
Other questions:
  • You just read an msds for acetic acid. based on what you read, what type of information is included in an msds sheet? record you
    7·1 answer
  • 1. What is the difference between a learner’s license and an operator’s license?
    10·1 answer
  • Music voice and sound effects can all be recorded and stored on a computer as
    15·1 answer
  • Which reading strategy refers to reading only the key words and phrases?
    13·2 answers
  • Part 1 Create a program that asks the user for a temperature in Fahrenheit, and then prints the temperature in Celsius. Search t
    12·1 answer
  • What’s the answer to this question?
    15·1 answer
  • Which of the following data structures can erase from its beginning or its end in O(1) time?
    15·1 answer
  • A group of students writes their names and unique student ID numbers on sheets of paper. The sheets are then randomly placed in
    15·1 answer
  • Which of the following statements is TRUE of a peer-to-peer network?
    10·1 answer
  • What is the binary conversion of 179.187.223.21?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!