Destide ( sirico@feddit.uk ) to Programmer Humor@lemmy.mlEnglish · 1 year agoInfallible Codelemmy.mlimagemessage-square36linkfedilinkarrow-up1273
arrow-up1273imageInfallible Codelemmy.mlDestide ( sirico@feddit.uk ) to Programmer Humor@lemmy.mlEnglish · 1 year agomessage-square36linkfedilink
minus-squareDestide ( sirico@feddit.uk ) OPlinkfedilinkEnglisharrow-up6·1 year agoAs we’re posting examples I’ll add how lovely it is in Elixir. Elixir def not putting the fun in programmer memes do. One reason I picked it because I can’t be trusted to not be the meme. def is_even?(n) do rem(n, 2) == 0 end
minus-squarebalsoft ( balsoft@lemmy.ml ) linkfedilinkarrow-up8·1 year agoI mean, it would be almost this exact thing in almost any language. fn is_even(n: i64) -> bool { n % 2 == 0 } even n = n `rem` 2 == 0 def is_even(n): return n % 2 == 0 etc
As we’re posting examples I’ll add how lovely it is in Elixir. Elixir def not putting the fun in programmer memes do. One reason I picked it because I can’t be trusted to not be the meme.
def is_even?(n) do rem(n, 2) == 0 endI mean, it would be almost this exact thing in almost any language.
fn is_even(n: i64) -> bool { n % 2 == 0 }def is_even(n): return n % 2 == 0etc