Multiple distinct objects: Difference between revisions

m
mNo edit summary
Line 636:
 
=={{header|Julia}}==
A potential mistake would be writing:
 
<lang Julia>>
The mistake might be in coding:
<lang Julia>>
foo() = rand() # repeated calls change the result with each call
repeat([foo()], outer=5) # but this only calls foo() once, clones that first value
</lang>
If the effect of calling foo() with every iteration is desired, better to use:
<br />
<lang Julia>
[foo() for i in 1:5] # Code this to call the function within each iteration
4,102

edits