All pastes #17554 Raw Edit

Anonymous

public text v1 · immutable
#17554 ·published 2005-07-12 17:27 UTC
rendered paste body
The template
----------------
Ok! let's start.
<%[centaurus class=jackasses]%>
<%= "Counting jackasses" %>
<% for (int i=0; i<10; i++)
{
%>
jackass # <%= i %>
<%
}
%>
Total was 10? Nice then :)
----------------
The code he generates, AND BUIL BY ITSELF!
----------------
class jackasses
                        {
                                public static string Generate (string[] args)
                                {
                                        string generatedcode="";
                                        generatedcode += @"Ok! let's start.
";
generatedcode += @"
";
generatedcode += "Counting jackasses" ;
generatedcode += @"
";
 for (int i=0; i<10; i++)
{
generatedcode += @"
jackass # ";
generatedcode += i ;
generatedcode += @"
";

}
generatedcode += @"
Total was 10? Nice then :)
";

                                        return generatedcode;
                                }

                                static void WriteToFile (string file, string code)
                                {
                                        System.IO.StreamWriter writer = new System.IO.StreamWriter (file);
                                        writer.Write (code);
                                        writer.Close ();
                                }
                                static void Main (string[] args)
                                {jackasses.Generate (args); }
                        }