1. Technology
Send to a Friend via Email
You can opt-out at any time. Please refer to our privacy policy for contact information.



Definition: To declare a variable in Ruby is to first refer to it. Many languages require formal declarations before a variable can be used, but in Ruby, you must simply assign a value to the variable to begin using it. To declare a variable in Ruby, you simply begin using it. Something akin to a formal declaration is needed to declare a method in Ruby. The def keyword begins such a formal declaration, defining the method name, parameters and body.
Also Known As: Define, Allocate

©2014 About.com. All rights reserved.