Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
Python, Lua and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Java, C, C++, Ruby, MySQL and Linux / Tomcat systems

Phone System reconfiguration 11.1.2018 and 12.1.2018 - we are on email but incoming phone not available all the time
 

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

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.
Articles and tips on this subjectupdated
4504Where does Ruby load modules from, and how to load from current directory
All (scripting) languages allow you to load code from other supporting source files, using keywords like use, load, source and include. In Ruby, the most common way to load other code is to require it - and if you use the require method you'll load in code from another file which will be assumed to ...
2015-06-03
 
4369Ruby - the second rung of learning the language
When you're learning a programming language - or to program - your text / tutor will almost inevitably start with "Hello World" - a program to display a string of text. That's chosen as the first example as it shows you how to enter and store you program, it shows you any steps necessary to convert ...
2014-12-30
 
4324Learning to program - variables and constants
Further material from our "learning to program in ...." courses ... an introduction to variables and constants variable basics Information - data - needs to be stored in a program between statements. Or rather it needs to be stored in the computer's memory. At the lowest of levels, that's a binary ...
2014-11-22
 
3917BODMAS - the order a computer evaluates arithmetic expressions
What order does a computer program use to evaluate expressions? If I write   2 + 3 * 4 + 5 does it start off, left to right ...   2 + 3 is 5   5 * 4 is 20   20 + 5 is 25 No! it does not, even though the newcomer might think that was the most natural way for ...
2012-11-10
 
3758Ruby - standard operators are overloaded. Perl - they are not
Ruby has been described to me as "What Perl 5.5 should have been", but that statement is a severe dis-service to Ruby, and to Perl. Ruby is a new language, and if you're moving into Ruby from Perl, you'll do best not to assume even the basics from Perl. A lot has been learend from Perl, for sure, ...
2012-06-16
 
3430Sigils - the characters on the start of variable names in Perl, Ruby and Fortran
A sigil (from Latin sigillum "seal") is a symbol created for a specific magical purpose. A sigil is usually made up of a complex combination of several specific symbols or geometric figures, each with a specific meaning or intent. In computer programming, a sigil is a special symbol attached to a variable ...
2011-09-10
 
3278Do I need to initialise variables - programming in C, C++, Perl, PHP, Python, Ruby or Java.
Starting with a clean slate. Are variables initisialised, and if so, how? Even with this fundamental question, languages vary considerably. C and C++ From my (e)mailbag ... """In a piece of code we’ve written we declare an array, but we do not fill the elements with values, we assume (dangerous ...
2011-05-05
 
2617Comparing floating point numbers - a word of caution and a solution
"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 like that as children, thinking of the number 0 ourselves so that we could do an easy calculation and impress our friends. And the result was 7 ... ...
2010-02-02
 
2613Constants 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 ...
2010-02-01
(short)
2296Variable scope - what is it, and how does it Ruby?
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 may be 'know about" to your program only within a very small area, or much more widely. It's the same IRL ("In Real Life") - consider you, Dad, Graham ...
2009-07-19
 
2287Learning to program in Ruby - examples of the programming basics
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 (also known as variable scope), what happens when you divide two numbers (do you get a decimal result or is the remainder thrown away), and how do ...
2009-07-15
 
986puts - opposite of chomp in Ruby
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 unless there's one already present. In Perl and other languages, a great deal of time and mental agility is expended in remembering where there are (and ...
2006-12-15
(short)
Examples from our training material
bluepeter   Throw a die and track sum of throws
bw.rb   Formatting strings and conversions
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   Print alternatives
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 [here].
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 Ruby, Lua, 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.


You can Add a comment or ranking to this page

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

PAGE: http://www.wellho.net/resources/R103.html • PAGE BUILT: Mon Feb 8 18:55:24 2016 • BUILD SYSTEM: WomanWithCat