Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact

Background
Ruby hasn't re-invented everything - it's taken the good basics from variables through "Bodmas" to statement structure and commenting from best practise elsewhere.
Tips and short articles on this subject
Comparing floating point numbers - a word of caution and a solution
Constants in Ruby
Variable scope - what is it, and how does it Ruby?
Learning to program in Ruby - examples of the programming basics
puts - opposite of chomp in Ruby
Well House Consultants
You are on the site of Well House Consultants who provide Open Source Training Courses and business hotel accommodation. You are welcome to browse and use our resources subject to our copyright statement and to add in links from your pages to ours.
Other subject areas - resources
Java Resources
Well House Manor Resources
Perl Resources
Python Resources
PHP Resources
Object Orientation and General topics
MySQL Resources
Linux / LAMP / Tomcat Resources
Well House Consultants Resources
Extras Resources
C and C++ Resources
Ruby Resources
Tcl/Tk Resources
Web and Intranet Resources
Ruby module R103
Basic Ruby Language Elements
Exercises, examples and other material relating to training module R103. This topic is presented on public courses Learning to program in Ruby, Ruby Programming

Ruby Programming - A Modern, Object Oriented, Portable Scripting language. This quickly moving course covers the fundamentals of the Ruby language for ...
http://www.wellho.net/course/rpfull.html  [course]
Learning to Program in Ruby - A Modern, Object Oriented, Portable Scripting language. Ruby is very much an object oriented language, and we concentrate ...
http://www.wellho.net/course/rlfull.html  [course]
# print is 'low level', puts # puts adds a \n if needed # p dumps a variable - so quotes it print "Hello Melksham\n" puts "Hello Trowbridge" puts "Hello ...
http://www.wellho.net/resources/ex.php4?item=r103/print.rb  [code sample]
We so often overlook the basics of programming, and yet they are so fundamental to good code - understanding things like how widely variables can be seen ...
http://www.wellho.net/mouth/2287_Lea ... asics.html  [short article]
In Ruby, the chomp method removes the last character of a string if it's a line separator. The puts method adds a new line character on to the output ...
http://www.wellho.net/mouth/986_puts ... -Ruby.html  [short article]
Variables have different "scopes" - in other words, a name that is allocated to a piece of computer memory and subsequently used to refer to that memory ...
http://www.wellho.net/mouth/2296_Var ... Ruby-.html  [short article]
"Think of a number between 5 and 15. Double it. Add fourteen. Halve it. Take away the number you first thought of. Is the result 7?" We all played games ...
http://www.wellho.net/mouth/2617_Com ... ution.html  [short article]

Ruby hasn't re-invented everything - it's taken the good basics from variables through "Bodmas" to statement structure and commenting from best practise elsewhere.

This topic is presented on public courses Learning to program in Ruby, Ruby Programming

Examples from our training material
calc.rb   Some early gotchas!
calcbetter.rb   A simple calculation in Ruby
d2.4   Easier output formatting in double quoted strings
d2.5   Calculations within double quotes
floater   Floating point rounding errors
muck   Common Ruby Pitfalls
print.rb   Variety in output - p, print and puts
rub1   FAILS to continue a line
x01   Constants in Ruby
Background information
Some modules are available for download as a sample of our material or under an Open Training Notes License for free download from http://www.training-notes.co.uk.
Topics covered in this module
Structure of statements and comments.
Variables and constants.
Operators.
Assignments, calculations, etc.
Integer, float and string formats.
Single and double quotes, here documents, general strings.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule page.

Well House Consultants specialise in training courses in Python, Perl, PHP, and MySQL. We run Private Courses throughout the UK (and beyond for longer courses), and Public Courses at our training centre in Melksham, Wiltshire, England. It's surprisingly cost effective to come on our public courses - even if you live in a different country or continent to us.

We have a technical library of over 700 books on the subjects on which we teach. These books are available for reference at our training centre. Also available is the Opentalk Forum for discussion of technical questions.


You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2010: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 344596 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho