Running a code for multiple values of the same variable

I wanna know if there is a simple way to run a code containing a variable x that should take more than one value and then store these values with the outputs of the code, for example x takes more than one value like 1 and 2 and 3, how can i run the code directly for once with all these values without changing the value of x everytime also how can i save the each output of each value of x

Use the dot notation for broadcasting.

x = [1, 2, 3]
y = log.(x)

what if:


and i want to do the same for x=[1,2,3]

This is more or less exactly what

is made for. It’s framed as a way of propagating probability distributions through nonlinear functions, but the way it does it is exactly what you are asking for, by propagating several samples from the distribution.

nice i will take a look at it and try to adapt it with my code, thanks a lot