Newbie tutorial - if statements

I need an opinion for my tutorial. I’m trying to figure out the easiest
way to teach if statements. I don’t know if I should teach them with the
"then" part or not.

if cond then

end

or

if cond

end

On the one hand, “then” makes it sound more like English. On the other,
it’s one more thing the student feels (s)he has to remember.

Any opinions?

Daniel.

My opinion is to drop the “then” part and to address “if” and “unless”
in the same section.

···

On Saturday, December 7, 2002, at 02:55 PM, Daniel Carrera wrote:

I need an opinion for my tutorial. I’m trying to figure out the
easiest
way to teach if statements. I don’t know if I should teach them with
the
“then” part or not.

if cond then

end

or

if cond

end

On the one hand, “then” makes it sound more like English. On the
other,
it’s one more thing the student feels (s)he has to remember.

Any opinions?

Daniel.

I can’t recall the last time I saw a “then” in any working ruby code - so I’d
leave it out.

···

On Sun, Dec 08, 2002 at 04:55:03AM +0900, Daniel Carrera wrote:

On the one hand, “then” makes it sound more like English. On the other,
it’s one more thing the student feels (s)he has to remember.


Alan Chen
Digikata Computing
http://digikata.com

Perhaps a small note saying:

“You may also see this in the form ‘if cond then’- This is another way
of writing if statements. Both are perfectly legal and mean the same
thing.”

Sun, 8 Dec 2002 05:09:02 +0900: Mark Wilson (Mark Wilson
mwilson13@cox.net):

···

My opinion is to drop the “then” part and to address “if” and “unless”

in the same section.

On Saturday, December 7, 2002, at 02:55 PM, Daniel Carrera wrote:

I need an opinion for my tutorial. I’m trying to figure out the
easiest
way to teach if statements. I don’t know if I should teach them
with the
“then” part or not.

if cond then

end

or

if cond

end

On the one hand, “then” makes it sound more like English. On the
other,
it’s one more thing the student feels (s)he has to remember.

Any opinions?

Daniel.


< There is a light that shines on the frontier >
< And maybe someday, We’re gonna be there. >
< Rando Christensen / rando@babblica.net >

I use it when I want to put an entire if - then - else statement on one line;
you need it to separate the condition from the first code block. It’s easier
to read in mancy cases than using the ternary operator, which I also
sometimes use in those situations - it depends on what I’m doing, why I’m
doing it and how much sleep I need.

Tim Bates

···

On Sun, 8 Dec 2002 06:46 am, Alan Chen wrote:

I can’t recall the last time I saw a “then” in any working ruby code - so
I’d leave it out.


tim@bates.id.au