What is a Foreach?

Foreach may refer to any of the following:


1.Foreach is a loop statement in programming that performs predefined tasks while or until a predetermined condition is met.

For example, in Perl you can use a foreach loop that prints all the elements of an array one by one. Sample code:

Foreach on array in Perl
foreach $value (@value) {
print "$value\n";}

If the elements of the array was "one," "two," and "three" each would be printed on a new line by itself.

Foreach on hash in Perl

In the next example the foreach would step through a hash displaying the hash and the key value.

foreach $example (keys %value) {
print "$example = $value{$example}";
}

2.Foreach is also a Linux command, see the foreach command page for further information.

What is an Operating System? » Computer Shortcut Keys and their Functions » Keyboard Function Keys » Computer Basics - Hardware - Software - Parts

Short Stories for Kids - Moral Stories – English Short Stories for Children - Moral Stories for Kids - Stories for Kids - Funny Story for Kids - Scary Stories for Kids - Really Funny Short Stories - Bedtime Stories
Proverb Stories
Powerful Motivational Quotes for Students » Success Quotes » English Short Stories for Kids

Cabin Crew Jobs & Career
Advice
» Secretary Job Description » Receptionist Job Description » Top 100 Interview Questions and Answers » How to Prepare for an Interview » How to Write a CV » How to Choose a Career » Computer Shortcut Keys and their Functions

Scholarships in Australia » Scholarships in Austria » Scholarships in Belgium » Scholarships in Canada » Scholarships in Germany » Scholarships in Ireland » Scholarships in Italy » Scholarships in Japan » Scholarships in Korea » Scholarships in Netherlands » Scholarships in Switzerland » Scholarships in UK » Scholarships in USA

Scholarships for Study in Africa » Scholarships for African Students » Undergraduate Scholarships » African Women Scholarships & Grants » Developing Countries Scholarships » Erasmus Mundus Scholarships for Developing Countries » Fellowship Programs » Funding Grants for NGOs » Government Scholarships » LLM Scholarships » MBA Scholarships » PhD and Masters by Research Scholarships » Public Health Scholarships - MPH Scholarships » Refugees Scholarships » Research Grants » Scholarships and Grants

Scholarships in Australia » Scholarships in Austria » Scholarships in Belgium » Scholarships in Canada » Scholarships in Germany » Scholarships in Italy » Scholarships in Japan » Scholarships in Korea » Scholarships in Netherlands » Scholarships in Switzerland » Scholarships in UK » Scholarships in USA


What is an Operating System?

Click here to post comments

Join in and write your own page! It's easy to do. How? Simply click here to return to Computer Basics FAQ.