What's new

Baka naman..

wendski

Honorary Poster
Established
Joined
Jan 29, 2017
Posts
246
Reaction
304
Points
176
Baka meron pa kau idea na wala sa idea ko..Pandagdag lang mga idol hahaha
 

Attachments

1.For loop allows a programmer to execute a sequence of statements several times, it abbreviates the code which helps to manage loop variables.While , While loop allows a programmer to repeat a single statement or a group of statements for the TRUE condition. It verifies the condition before executing the loop.A "For" Loop is used to repeat a specific block of code a known number of times. For example, if we want to check the grade of every student in the class, we loop from 1 to that number. When the number of times is not known before hand, we use a "While" loop.



In general, you should use a for loop when you know how many times the loop should run. If you want the loop to break based on a condition other than the number of times it runs, you should use a while loop.

Strings and arrays are quite similar except the length of an array is fixed whereas strings can have a variable number of elements. Technically, arrays are a special type of variable that can hold more than one value at a time. They are a sequential collection of elements of similar data types, whereas strings are a sequence of characters used to represent text rather than numbers. In addition, strings are immutable which means the value of an object cannot be modified once it’s created, while arrays are mutable meaning the fields can be modified. Simply put, an array is a collection of like-type variables whereas a string is a sequence of characters represented by a single data type.
 
1.For loop allows a programmer to execute a sequence of statements several times, it abbreviates the code which helps to manage loop variables.While , While loop allows a programmer to repeat a single statement or a group of statements for the TRUE condition. It verifies the condition before executing the loop.A "For" Loop is used to repeat a specific block of code a known number of times. For example, if we want to check the grade of every student in the class, we loop from 1 to that number. When the number of times is not known before hand, we use a "While" loop.



In general, you should use a for loop when you know how many times the loop should run. If you want the loop to break based on a condition other than the number of times it runs, you should use a while loop.

Strings and arrays are quite similar except the length of an array is fixed whereas strings can have a variable number of elements. Technically, arrays are a special type of variable that can hold more than one value at a time. They are a sequential collection of elements of similar data types, whereas strings are a sequence of characters used to represent text rather than numbers. In addition, strings are immutable which means the value of an object cannot be modified once it’s created, while arrays are mutable meaning the fields can be modified. Simply put, an array is a collection of like-type variables whereas a string is a sequence of characters represented by a single data type.
Salamat prof sa pag share ng idea mo rin.
 

Similar threads

Back
Top