Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2021 - online Python 3 training - see ((here)).

Our plans were to retire in summer 2020 and see the world, but Coronavirus has lead us into a lot of lockdown programming in Python 3 and PHP 7.
We can now offer tailored online training - small groups, real tutors - works really well for groups of 4 to 14 delegates. Anywhere in the world; course language English.

Please ask about private 'maintenance' training for Python 2, Tcl, Perl, PHP, Lua, etc.
Ruby - where one statement ends and the next begins

In Ruby, you can end your statements with a ;, but it's more usual to simply let them end at the end of a line. Ruby can usually identify where a statement ends and if it clearly doesn't end on one line, it carries on to the next.

Just occasionally, this can be little bit of a trap. Look at this code with teo apparently identicsl statements giving different results. Why?

  a = 5
  b = a
    + 6
  puts b
  b = a +
    6
  puts b
  
  __END__
  
  trainee@kingston:~/lrp$ ruby ld
  5
  11
  trainee@kingston:~/lrp$


The answer is that Ruby has split the first "statement" into two - whereas the second example clearly continued from one line to the next and was treated as a single statement.

It's great to be teaching Ruby this week - see our Ruby Courses ... and I'll be going on to Cucumber and Gherkin over the next couple of days.
(written 2015-05-26, updated 2015-05-27)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
R101 - Ruby - Introduction
  [550] 2006 - Making business a pleasure - (2006-01-01)
  [664] Ruby course - oops - it's not happening - (2006-04-01)
  [1027] Cue the music, I'm happy. - (2007-01-09)
  [1041] Learnt in London - Ruby, Martini, Coral and the Core - (2007-01-17)
  [1302] Ruby, Ruby, Ruby. Rails, Rails, Rails. - (2007-08-13)
  [1375] Python v Ruby - (2007-10-02)
  [1887] Ruby Programming Course - Saturday and Sunday - (2008-11-16)
  [2286] New to programming? It is natural (but needless) for you to be nervous - (2009-07-14)
  [2287] Learning to program in Ruby - examples of the programming basics - (2009-07-15)
  [2607] Answers on Ruby on Rails - (2010-01-30)
  [4369] Ruby - the second rung of learning the language - (2014-12-28)


Back to
Around the world from Melksham
Previous and next
or
Horse's mouth home
Forward to
Significant work - beyond helloworld in Ruby
Some other Articles
Reading and parsing a JSON object in Ruby
Defining the behaviour of your web site and testing that it works
The TransWilts Community Intergrated Transport Corridor
Significant work - beyond helloworld in Ruby
Ruby - where one statement ends and the next begins
Around the world from Melksham
Sunday train times - 17th May to 6th September 2015
Swindon to Westbury train services - Saturdays from 23rd May 2015
Monday to Friday / TransWilts train times from 18 May to 11th December 2015
Forgotten / lost MySQL root password
4759 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, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 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).

You can Add a comment or ranking to this page

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

PAGE: http://www.wellho.net/mouth/4498_Rub ... egins.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb