Foreach c# là gì

Foreach loop is used lớn access elements of an array quickly without performing initialization, testing & increment/decrement. The working of foreach loops is khổng lồ bởi something for every element rather than doing something n times.There is no foreach loop in C, but both C++ & Java have support for foreach type of loop. In C++, it was introduced in C++ 11 và Java in JDK 1.5.0The từ khóa used for foreach loop is “for” in both C++ và Java.C++ Program:

Bạn đang xem: Foreach c# là gì

Advantages of Foreach loop:-1) Makes code more readable.2) Eliminates the possibility of programming errors.This article is contributed by Rahul Agrawal. If you like and would like to contribute, you can also write an article & mail your article lớn contribute See your article appearing on the main page and help other Geeks.Please write comments if you find anything incorrect, or you want khổng lồ nói qua more information about the topic discussed above
Want to learn from the best curated videos and practice problems, kiểm tra out the C++ Foundation Course for Basic khổng lồ Advanced C++ và C++ STL Course for foundation plus STL. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
Competitive sầu Programming Live Classes for Students

Xem thêm: Quy Định Về Hàng Tạm Nhập Tái Xuất Là Gì ? Tạm Nhập Tái Xuất Là Gì

DSA Self Paced Course
DSA Live sầu Classes for Working Professionals
Object Oriented Programming in C++Bitwise Operators in C/C++Initialize a vector in C++ (6 different ways)C++ Classes & ObjectsInheritance in C++
Arrays in Java10 Most Popular Java Frameworks That You Must TrySplit() String method in Java with examplesFor-each loop in JavaArrays.sort() in Java with examples
We use cookies to lớn ensure you have the best browsing experience on our trang web. By using our site, youacknowledge that you have read và understood ourCookie Policy và Privacy PolicyGot It !

Leave a Reply

Your email address will not be published. Required fields are marked *