|
Constants in Ruby
If you want to have a read only variable in Ruby, start its name with a capital letter (and you may like to go with a convention of using capitals right through the variable name).
Note that a Ruby constant - a name starting with a capital - hasa global scope, just like a variable name that starts with a $
There's an example [here] from today's Learning to Program in Ruby Training Course.
(written 2010-02-01)
Associated topics are indexed under R103 - Basic Ruby Language Elements [3917] BODMAS - the order a computer evaluates arithmetic expressions - (2012-11-09) [3758] Ruby - standard operators are overloaded. Perl - they are not - (2012-06-09) [3430] Sigils - the characters on the start of variable names in Perl, Ruby and Fortran - (2011-09-10) [3278] Do I need to initialise variables - programming in C, C++, Perl, PHP, Python, Ruby or Java. - (2011-05-05) [2617] Comparing floating point numbers - a word of caution and a solution - (2010-02-01) [2296] Variable scope - what is it, and how does it Ruby? - (2009-07-18) [2287] Learning to program in Ruby - examples of the programming basics - (2009-07-15) [986] puts - opposite of chomp in Ruby - (2006-12-15) R110 - Ruby - Special Variables and Pseudo-Variables [3757] Ruby - a teaching example showing many of the language features in short but useful program - (2012-06-09) [2623] Object Oriented Ruby - new examples - (2010-02-03) [1891] Ruby to access web services - (2008-11-16) [1587] Some Ruby programming examples from our course - (2008-03-21) [1586] Variable types in Ruby - (2008-03-21) [990] Ruby - Totally Topical - (2006-12-16)
5286
Some other Articles
Defining a static method - Java, Python and RubyString to number conversion with error trapping in RubyNeatly formatting results into a tableConstants in RubyThe Model, View, Controller architecture (MVC) - what, why and how.Sunday Evening, City of LondonCheat Sheet - what do you need for Ruby on Rails?Scope of variables - important to Ruby on RailsSearch and replace in Ruby - Ruby Regular Expressions
|
4084 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82 at 50 posts per page
This is a page archived from The Horse's Mouth at
http://www.wellho.net/horse/ -
the diary and writings of Graham Ellis.
Every attempt was made to provide current information at the time the
page was written, but things do move forward in our business - new software
releases, price changes, new techniques. Please check back via
our main site for current courses,
prices, versions, etc - any mention of a price in "The Horse's Mouth"
cannot be taken as an offer to supply at that price.
Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).
|
|