This language bar is your friend. Select your favorite languages!

Idiom #161 Multiply all the elements of a list

Multiply all the elements of the list elements by a constant c

for (auto &it : elements)
	it *= c;
(map (partial * c) elements)
elements[] *= c;
for i := range elements {
	elements[i] *= c
map (*c) elements
for i := Low(elements) to High(elements) do 
  elements[i] := elements[i] * c;
elements = map(lambda x: c*x, elements)!{|el| el * c }
let elements = elements.into_iter().map(|x| c * x).collect::<Vec<_>>();

Do you know the best way to do this in your language ?
New implementation...

Idiom created by