Manage Learn to apply best practices and optimize your operations.

Delimiting the main code in JScript.NET

The majority of programming languages delimit the main program section. But this isn't the case with JScript.NET or JavaScript. In this tip, member Chandra Teja offers code that you can place anywhere in your JScript.NET class definitions to delimit the main code.

Most programming languages delimit the main program section with a keyword such as Main() or main(). JScript.NET and JavaScript are different. Luckily, the main code in JScript.NET is not delimited in any way and you can write the code outside. You can write it before, after, or in between the class definitions.

Here is an example that includes two class definitions followed by the main code section:

// compile with: jsc inheritance.js

  class Base {
    protected var i : int = 5;
    public function PrintInBase() : void {
      print("i is " +  i);

  class Derived extends Base {
    var d : double = 7.3;
    public function PrintInDerived() : void {
      print("i is " + i + ", d is " + d);

  var b : Base = new Base();
  var d : Derived = new Derived();

Do you have comments on this tip? Let us know.

Related information from

  • FAQ: JavaScript advice
  • Tip: Delete documents over the Web using Ajax and JavaScript
  • Learning Guide: JavaScript for Lotus Notes and Domino
  • Reference Center: JavaScript tips and resources

    This tip was submitted to the tip library by member Chandra Teja. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

  • Dig Deeper on JavaScript for Lotus Notes Domino

    Start the conversation

    Send me notifications when other members comment.

    Please create a username to comment.




    • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

    • V6R1 upgrade planning checklist

      When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

    • Connecting multiple iSeries systems through DDM

      Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...