Advertisement
zvoulgaris

Counting Fingers

Jun 16th, 2020
2,766
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Julia 0.34 KB | None | 0 0
  1. # Counting Fingers Drill
  2.  
  3. fingers = ["Thumb", "Index", "Middle", "Ring", "Pinkie"]
  4.  
  5. function main(n::Int64)
  6.     if n < 1; println("She can't count non-positive numbers!"); return ""; end
  7.     x = n % 8
  8.  
  9.     if x == 0
  10.         x = 2
  11.     elseif x == 7
  12.         x = 3
  13.     elseif x == 6
  14.         x = 4
  15.     end
  16.  
  17.     return fingers[x]
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement