in reply to Re: Printing two variables in the same line
in thread Printing two variables in the same line

I have been advised by some people I trust, and have a huge ammount of respect for, To always put a semi-colon on the end of every statement, even those at the end of a block. While using a semi-colon on the last statement of a block is not necissary, it can help maintainablity. I can think of a hundered situations where I have gone back and added code into an existing block, and if the semi-colon is not there, when I'm adding to it later, I am likely to forget (until I try to run the code and it doesn't compile).

May the Force be with you
  • Comment on Re^2: Printing two variables in the same line

Replies are listed 'Best First'.
Re^3: Printing two variables in the same line
by The_Rabbit (Acolyte) on Oct 07, 2004 at 20:58 UTC

    Hmm, I don't think I was being clear enough. The author had:

    if { } else { };

    I'm not talking about having a semi-colon at the end of the last statment in a block. I'm talking about having a semi-colon AFTER the closing curly brace at the end of the block.

      I'm not talking about having a semi-colon at the end of the last statment in a block. I'm talking about having a semi-colon AFTER the closing curly brace at the end of the block.

      That was clear to me! Personally I never put a semicolon after a block. But then I often forget to put one at the end of an eval statement. So perhaps if I had a coding style that put a redundant semiclon after all blocks then I wouldn't forget them where necessary?

      Smylers

      Ahh Soo. :-) You are most correct that a semi-colon following the } is quite unnecessary.

      May the Force be with you