Nice TWiki > Doc > StrcatBeginnerExample (r1.1 vs. r1.4) TWiki webs:
Dev | Doc | Main | TWiki | Sandbox
Doc . { Changes | Index | Search | Go }
 <<O>>  Difference Topic StrcatBeginnerExample (r1.4 - 10 Jan 2004 - IsaacGouy)
Changed:
<
<

println(buffer.length());

>
>

println(buffer.length);


 <<O>>  Difference Topic StrcatBeginnerExample (r1.3 - 10 Jan 2004 - IsaacGouy)

 <<O>>  Difference Topic StrcatBeginnerExample (r1.2 - 27 Aug 2003 - IsaacGouy)
Changed:
<
<

/* Please try the BeginnerExamples? before the NoviceExamples?

>
>

/* Please try the NoviceExamples? before the BeginnerExamples?

Added:
>
>

%META:TOPICMOVED{by="IsaacGouy" date="1062001968" from="Doc.StrcatNoviceExample" to="Doc.StrcatBeginnerExample"}%


 <<O>>  Difference Topic StrcatBeginnerExample (r1.1 - 27 Aug 2003 - IsaacGouy)
Added:
>
>

%META:TOPICINFO{author="IsaacGouy" date="1061947560" format="1.0" version="1.1"}% %META:TOPICPARENT{name="CodeExamples"}%

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


void main(String[] args){
   var n = toSingleInt(args);
   let s = "hello\n";
   let buffer = new StringBuffer(32);

   while (n-- > 0) buffer.append(s);

   println(buffer.length()); 
}


int toSingleInt(String[] s){
   try { return Integer.parseInt(s[0]); }
   catch (Exception e){ return 1; } }


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

   let buffer = new StringBuffer(32);
Declare and initialize StringBuffer buffer, the compiler will infer 
the type from the initial assignment. Identifiers declared with 
keyword let can be assigned a value only once. 

*/
-- IsaacGouy - 27 Aug 2003

Topic StrcatBeginnerExample . { View | Diffs | r1.4 | > | r1.3 | > | r1.2 | More }
Revision r1.1 - 27 Aug 2003 - 01:26 GMT - IsaacGouy
Revision r1.4 - 10 Jan 2004 - 19:06 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.