Top "Foreach" questions

foreach is a looping construct that executes a given piece of code for each element in a list/collection/array.

using BOOST_FOREACH with std::map

I'd like to iterate over a std::map using BOOST_FOREACH and edit the values. I can't quite get it. …

c++ boost foreach maps std
Getting "The connection does not support MultipleActiveResultSets" in a ForEach with async-await

I have the following code using Dapper.SimpleCRUD : var test = new FallEnvironmentalCondition[] { new FallEnvironmentalCondition {Id=40,FallId=3,EnvironmentalConditionId=1}, new FallEnvironmentalCondition {Id=41,…

c# sql-server foreach async-await dapper
How to access key and value of an array in smarty template?

I'm assigning an array named $enquiries_labels from php file to a smarty template file. If I print the array …

php arrays foreach smarty
How to insert a counter into a Stream<String> .forEach()?

FileWriter writer = new FileWriter(output_file); int i = 0; try (Stream<String> lines = Files.lines(Paths.get(input_file))) { …

java foreach java-stream line-numbers
Basic XML/XSLT - value-of when there are multiple elements of the same name

When I'm getting the value of an element which is used multiple times in the same parent element, I'd like …

xml xslt foreach value-of
List.ForEach in vb.net - perplexing me

Consider the following code example: TempList.ForEach(Function(obj) obj.Deleted = True End Function) And this one: TempList.ForEach(Function(…

vb.net foreach generic-list
using array merge into a foreach loop

I need to merge a new array of alternative information into the loop if they have the alternative information in …

php foreach array-merge
How do I convert a JavaScript forEach loop/function to CoffeeScript

Background: I'm trying to convert some JavaScript code which uses the the Crossfilter library with D3.js data visualization library …

javascript foreach coffeescript d3.js crossfilter
How can I print when using %dopar%

I have a foreach loop that uses %dopar% with doSNOW as the back-end. How can I have the loop print …

r foreach parallel-processing
Is it possible to use boost::foreach with std::map?

I find boost::foreach very useful as it saves me a lot of writing. For example, let's say I want …

c++ boost foreach