|
Generalized, a Ruby statement is each and every instruction you write.
For example, this:
x="i'm a statement"
or this:
if (x!=1)
y="wrong"
are statements of some sort.
A statement is more of a general programming term not necessarily with a specific format in Ruby.It is true that,unlike C++ for example, you don't need to end each line with a ; sign or the fact that if..else or other conditional instructions might be written in a slightly different way that in other programming languages.
In a more restrictive meaning ("by the book," so to speak), a statement is an instruction that does not return a value. I've met a lot of people that no longer make this distinction though; probably for the wrong reasons.
If you were to consider this definition, the second code example I gave would no longer represent a statement, but a larger piece of code.
There isn't much to say about statements in Ruby in particular, you will most likely pick up everything there is to know about them just by following through the tutorial.Check this article to read more about statements.
|