Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.17 KB | None | 0 0
  1. def string_rev_if_4(input)
  2. return input.reverse if input.length < 4
  3. input
  4. end
  5.  
  6. string_rev_if_4("he") # "eh"
  7. string_rev_if_4("hel") # "leh"
  8. string_rev_if_4("hell") # "hell"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement