Towards the end of our programming language training courses, we pull together all the various strands into a worked example that shows how they go together. I've just posted such an example from last week's Ruby Programming Course ... [here].
Let's have a look at some of the things in the example ....
There's some 700 technical books in the Well House Consultants library in Melksham, and several hundred other books too on the shelves at Well House Manor, making for a comfortable and relaxing room where the geekier of our guests can read about MySQL, Lua, or Ruby, and the less geeky folks can read ....
This morning, I walked around Melksham's town centre really early, popping reminders about next Tuesday morning though the letterboxes on the various business doors. I love these walks around - it gives me a chance to look, to observe, and to think. And it's quick - they say that an errand th ....
If there are eight of us at a meeting, how many possibilities are there for a pair of people to stongly disagree? The answer turns out to be 28. And if you look at subgoups of 3, looking for everyone to have the same opinion within the subgroup, the answer is many more.
If there are eight stations ....
How can you display your whole file tree on a Linux system? With the tree command!
|-- abo
|-- access_log
|-- adarrivals.txt
|-- adhoc_private
| |-- adhoc.conf
| |-- businesslogic.inc
| |-- page_layout.htp
|&nbs ....
If you're wanting to process every member of an array, you've a choice ... you can write a loop to step through the key of each member, you can write a loop to step through each member itself, or you can call a method which operates on the array as a whole (i.e. the loop is hidden within a method. ....
Has it ever struck you as curious that in many languages, you can pass as many parameters into a function as you like, but you can only return one? Well - that's many language not all - in Ruby you can return a whole series of values in a comma separated list, and place each into its own variable.
....
There's often a requirement in a program to see if one value is between two others, and in most languages you'll write that as as double condition:
if (n >= 5 && n <= 8) printf("Yesssss!\n");
in C or C++, for example.
Some languages give you further options / methods you ....
There are time when you're writing a program where you say "I don't know".
• I don't know how many records / object I'm going to read from a data file into an array - so I can't set the size of my array
• I don't know what sort of object I'll be creating from a line I've read from a da ....
In a previous article ([here]), I talked about how we introduce the basic concepts of classes, methods and objects on our C++ courses. I'm now going to give you some links to the next series of example which I wrote during that same course.
Having covered object basics, we moved on to look at relat ....