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, SearchDomino.com 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();
  print("b:");
  b.PrintInBase();
  var d : Derived = new Derived();
  print("d:");
  d.PrintInBase();
  d.PrintInDerived();

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

Related information from SearchDomino.com:

  • 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 SearchDomino.com 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.

  • This was last published in December 2006

    Dig Deeper on JavaScript for Lotus Notes Domino

    Start the conversation

    Send me notifications when other members comment.

    By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

    Please create a username to comment.

    -ADS BY GOOGLE

    SearchWindowsServer

    Search400

    • iSeries tutorials

      Search400.com'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 ...

    SearchDataCenter

    SearchExchange

    SearchContentManagement

    Close