TWiki . Doc . ObjinstBeginnerExample

/* Please try the NoviceExamples before the BeginnerExamples
To compile:
   nicec --sourcepath=.. -a objinst.jar objinst
To run:
   java -jar objinst.jar 1000000

import methcall; 

void main(String[] args){
   let n = toSingleInt(args);

   var toggle = new Toggle();
   for(var i=0; i<5; i++) println( toggle.activate.value );
   for(var i=0; i<n; i++) toggle = new Toggle();


   var ntoggle = new NToggle(toggleTrigger: 3);
   for(var i=0; i<8; i++) println( ntoggle.activate.value );
   for(var i=0; i<n; i++) ntoggle = new NToggle(toggleTrigger: 3);

/* Notes - language
Compare with Java at the "Win32 Language Shootout"

   import methcall; 
Reuse the implementation of class Toggle & NToggle and the
function toSingleInt that were defined in package methcall.
Assume the packages are in \project\methcall and \project\objinst 

Note that the whole package methcall is imported.
-- IsaacGouy - 27 Aug 2003

----- Revision r1.4 - 10 Jan 2004 - 19:05 GMT - IsaacGouy
Copyright © 1999-2003 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback.