[Solved] Length of input characters in Ruby
Why they are different ? It’s because in the second example there is a newline symbol also counted \n. Check it: print “Your age:” age=gets print age “33\n” print age.chomp.length # without newline #> 2 print age.length # with newline #> 3 chomp Returns a new String with the given record separator removed from the … Read more