answersLogoWhite

0

What is foreach statement give example?

Updated: 9/19/2023
User Avatar

Wiki User

13y ago

Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: What is foreach statement give example?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Is it mandatory to use array in foreach loop C-sharp can foreach be used without array?

Foreach is for an IEnumerable, not just an array (unless you are using C# 1.1 or earlier). A collection (List, Dictionary, etc) can also generate a sequence from foreach-statement. In fact, if you have a class that is NOT an array, but it implements all the required methods of IEnumerable, it may be applied as:public class Storage: IEnumerable {...}Storage myStorage = new Storage();...Foreach (Thing stuff in myStorage){...}


What is the syntax of foreach in c?

There is no 'foreach' in C


How do you writte foreach loop in net?

Assuming your data store implements the "IEnumerable" interface (or the IEnumerable generic interface) foreach (type arg in datastore) { ... } So, for example, if you have a List, it would be List list = new List() ... foreach (string val in list) { Console.Out.WriteLine(val); }


Can you give an example of poisoning the well a fallacy statement?

can you give the definition and an example of the fallacy of poisoning the well


Draw a general statement that holds true for streetrees?

give the example of general statement were no streetrees


What is the importance of foreach loop in php?

The foreach construct simply gives an easy way to iterate over arrays. Foreach works only on arrays (and objects).


What are the advantages of using a foreach loop over a for or while loop for processing list elements?

foreach can simply replace for loop. for ex in perl, if you need to copy display an array, it will take only foreach $var(@arr). then print $var. no need of incrementing the index of array like for loop.


Could you give me a example of the word statement in a sentence?

The teacher made a statement to the class about tutoring after school.


Give an example of a positive and normative statement about the economy You can choose any economic issue that interests you?

positive example


Difference between for and foreach?

difference between for and for each loop..?The for loop executes a statement or a block of statements repeatedly until a specified expression evaluates to false. there is need to specify the loop bounds( minimum or maximum).int j = 0;for (int i = 1; i


What is an example of a persuasive thesis statement?

Our school should do more to give back to the community.


What is an example of persuasive thesis statement?

Our school should do more to give back to the community.