From: John n/a Date: 2013-03-30T01:06:04+09:00 Subject: Ruby Typing? Hi everyone. I'm very new to ruby development. I coming form .Net side of things. Is there any way in ruby to verify the type of whatever parameter your passing to a method and give the user a good message. For example: def Add_two_numbers(x,y) ....if type of x is not integer throw an error "x was expected to be an integer and is not" .....if type of y is not an integer throw an error "y was expected to be an integer and is not" end When i just hit a bug where i was expecting an array of comments and instead a single comment was passed (in the constructor). The code exploded with i tried to do "@comments << comments[0]" because @comments was not an array with an error message like "undefined function '<<' which took me awhile to figure out. Want to try to prevent this in the future if possible. thanks... -- Posted via http://www.ruby-forum.com/.