Does JScript.NET have a "main()" function for global entry point?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I was wondering if JScript.NET has a "main()" function for a global entry point? Like in C# and C++? I have searched alot everywhere and can't seem to find an answer. Though one answer was to place the STAThread Attribute on top of a function called main, but that didn't work.
 
miffy900 said:
I was wondering if JScript.NET has a "main()" function for a global entry point? Like in C# and C++? I have searched alot everywhere and can't seem to find an answer. Though one answer was to place the STAThread Attribute on top of a function called main, but that didn't work.

Nope. Just like in standard Javascript, the statements are executed
from the top of the file.
 
But why wouldn't there be? Whats the point in having a real exe app if you can't insert any arguments? By the way, can you in JScript.NET? (maybe by some other means)
 
miffy900 said:
But why wouldn't there be? Whats the point in having a real exe app if you can't insert any arguments? By the way, can you in JScript.NET? (maybe by some other means)

I by "insert any arguments" you mean getting command line arguments, you
can use the .NET Framework classes to grab these things:

// ====== args.js =============================
import System;

var args = Environment.GetCommandLineArgs();

var argCount = args.Length;

for (var i = 0; i < argCount; i++) {
print( args);
}
// ================================================


Compile the above using:

jsc args.js
 
Back
Top