jackpot@lemmy.ml to Programming@programming.dev · 11 months agowhen is it best to use a recursive function vs a for loopmessage-squaremessage-square52fedilinkarrow-up134arrow-down13
arrow-up131arrow-down1message-squarewhen is it best to use a recursive function vs a for loopjackpot@lemmy.ml to Programming@programming.dev · 11 months agomessage-square52fedilink
minus-squareglitches_brew@lemmy.worldlinkfedilinkarrow-up5·edit-211 months agoElixir does have for loops. for n \<- 1..5 do n * 2 end # => [2, 4, 6, 8, 10] That being said, I have worked at a company who uses Elixir 4 years now and I have never once written one.
minus-squarecosmicrose@lemmy.worldlinkfedilinkEnglisharrow-up3·11 months agoOh you’re so right, I never use those so I completely forgot :X
Elixir does have for loops.
for n \<- 1..5 do n * 2 end # => [2, 4, 6, 8, 10]
That being said, I have worked at a company who uses Elixir 4 years now and I have never once written one.
Oh you’re so right, I never use those so I completely forgot :X