﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-emu in blogjava-随笔分类-Groovy 学习笔记</title><link>http://www.blogjava.net/emu/category/1400.html</link><description /><language>zh-cn</language><lastBuildDate>Tue, 27 Feb 2007 11:27:46 GMT</lastBuildDate><pubDate>Tue, 27 Feb 2007 11:27:46 GMT</pubDate><ttl>60</ttl><item><title>Groovy 学习笔记4 package</title><link>http://www.blogjava.net/emu/archive/2005/05/19/4878.html</link><dc:creator>emu</dc:creator><author>emu</author><pubDate>Thu, 19 May 2005 10:37:00 GMT</pubDate><guid>http://www.blogjava.net/emu/archive/2005/05/19/4878.html</guid><wfw:comment>http://www.blogjava.net/emu/comments/4878.html</wfw:comment><comments>http://www.blogjava.net/emu/archive/2005/05/19/4878.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/emu/comments/commentRss/4878.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/emu/services/trackbacks/4878.html</trackback:ping><description><![CDATA[一个面向对象的语言往往都是通过package把对象组织起来的，但是很奇怪居然没有找到groovy的package方面的资料，难道groovy不支持？那么我们怎么用groovy来设计负责一点的程序呢？还是做试验试试吧：<BR><BR>Dog.groovy:<BR><BR>
<DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
<DIV><SPAN style="COLOR: #008080">&nbsp;1</SPAN><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">package&nbsp;com<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;2</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_22_137_Open_Image onclick="this.style.display='none'; Codehighlighter1_22_137_Open_Text.style.display='none'; Codehighlighter1_22_137_Closed_Image.style.display='inline'; Codehighlighter1_22_137_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_22_137_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_22_137_Closed_Text.style.display='none'; Codehighlighter1_22_137_Open_Image.style.display='inline'; Codehighlighter1_22_137_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">&nbsp;Dog&nbsp;</SPAN><SPAN id=Codehighlighter1_22_137_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_22_137_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;3</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;def&nbsp;name;<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;4</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_56_83_Open_Image onclick="this.style.display='none'; Codehighlighter1_56_83_Open_Text.style.display='none'; Codehighlighter1_56_83_Closed_Image.style.display='inline'; Codehighlighter1_56_83_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_56_83_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_56_83_Closed_Text.style.display='none'; Codehighlighter1_56_83_Open_Image.style.display='inline'; Codehighlighter1_56_83_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;def&nbsp;bark&nbsp;()&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_56_83_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_56_83_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;5</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;println(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">barking</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">)<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;6</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_98_135_Open_Image onclick="this.style.display='none'; Codehighlighter1_98_135_Open_Text.style.display='none'; Codehighlighter1_98_135_Closed_Image.style.display='inline'; Codehighlighter1_98_135_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_98_135_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_98_135_Closed_Text.style.display='none'; Codehighlighter1_98_135_Open_Image.style.display='inline'; Codehighlighter1_98_135_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;def&nbsp;say&nbsp;()&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_98_135_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_98_135_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;println(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">My&nbsp;name&nbsp;is&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">name);<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;9</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">11</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN></DIV></DIV><BR><BR>嗯，一只会说一句话的狗，还回吠哦。<BR><BR>编译一下看看有没有错： groovyc Dog.groovy<BR>嗯，没有错，而且在当前目录下生成了一个com目录，其中有Dog.class文件<BR><BR>再建一个类来引用这个类&nbsp; trainDog.groovy：<BR>
<DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
<DIV><SPAN style="COLOR: #008080">1</SPAN><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">dog&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;com.Dog(name:</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Doggie</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">2</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>dog.bark();<BR></SPAN><SPAN style="COLOR: #008080">3</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>dog.say();<BR></SPAN><SPAN style="COLOR: #008080">4</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN></DIV></DIV>
<P><BR><BR>运行……失败了：<BR><BR>Caught: General error during class generation: No such class: com.Dog in constructor call for class: trainDog. At [1:7] D:\groovy\mygroovy\com\trainDog.groovy<BR><BR>一番努力之后，始终无法让 trainDog.groovy运行起来，但是反编译这两个groovy生成的class文件看起来又很正确。算了，用java来运行它吧（还好一开始就配置了editplus下面的调试环境，下面的命令由editplus自动生成，不用自己敲了）<BR><BR>D:\jdk1.5.0\bin\java.exe -classpath .;d:\groovy\groovy-1.0-jsr-01.jar;d:\groovy\lib\asm-1.5.2.jar trainDog<BR><BR>果然不错：<BR><BR>---------- java ----------<BR>barking<BR>My name is Doggie<BR>Normal Termination<BR>输出完成(耗时 0 秒)。</P>
<P><BR>看来groovy虽然可以直接运行，却不能直接相互引用。进行复杂应用的时候还是要先编译好以便他们可以相互引用类文件。此外groovy编译器会自动为包创建对应的目录，所以所有的groovy不管分散到多少包里面都要在同一个目录（所有包的上一层）下面编译。<BR></P><img src ="http://www.blogjava.net/emu/aggbug/4878.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/emu/" target="_blank">emu</a> 2005-05-19 18:37 <a href="http://www.blogjava.net/emu/archive/2005/05/19/4878.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Groovy 学习笔记3 运行效率  </title><link>http://www.blogjava.net/emu/archive/2005/05/18/4784.html</link><dc:creator>emu</dc:creator><author>emu</author><pubDate>Wed, 18 May 2005 10:19:00 GMT</pubDate><guid>http://www.blogjava.net/emu/archive/2005/05/18/4784.html</guid><wfw:comment>http://www.blogjava.net/emu/comments/4784.html</wfw:comment><comments>http://www.blogjava.net/emu/archive/2005/05/18/4784.html#Feedback</comments><slash:comments>9</slash:comments><wfw:commentRss>http://www.blogjava.net/emu/comments/commentRss/4784.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/emu/services/trackbacks/4784.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;第一篇笔记里面，我说groovy运行的居然还满快的，其实是个误会了。我上次做八皇后还是在8080上面用basic做的，和现在奔四上面的groovy相比是没有意义的。特地又做了个对比试验：&nbsp;&nbsp;1int&nbsp;q=9&nbsp;2int[]&nbsp;i=new&nbsp;int[q]&nbsp;3int&nbsp;count=0&nbsp;4long&nbsp;t...&nbsp;&nbsp;<a href='http://www.blogjava.net/emu/archive/2005/05/18/4784.html'>阅读全文</a><img src ="http://www.blogjava.net/emu/aggbug/4784.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/emu/" target="_blank">emu</a> 2005-05-18 18:19 <a href="http://www.blogjava.net/emu/archive/2005/05/18/4784.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>groovy 学习笔记2 IDE </title><link>http://www.blogjava.net/emu/archive/2005/05/18/4781.html</link><dc:creator>emu</dc:creator><author>emu</author><pubDate>Wed, 18 May 2005 09:55:00 GMT</pubDate><guid>http://www.blogjava.net/emu/archive/2005/05/18/4781.html</guid><wfw:comment>http://www.blogjava.net/emu/comments/4781.html</wfw:comment><comments>http://www.blogjava.net/emu/archive/2005/05/18/4781.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/emu/comments/commentRss/4781.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/emu/services/trackbacks/4781.html</trackback:ping><description><![CDATA[<TABLE style="BORDER-COLLAPSE: collapse" width="95%" border=0>
<TBODY>
<TR>
<TD class=BlogArticlePostTime><SPAN id=BlogBody_BlogArticleView_lbPostTime></SPAN></TD></TR>
<TR>
<TD class=BlogArticleTitle></TD></TR>
<TR>
<TD class=BlogArticleContent>
<TABLE style="TABLE-LAYOUT: fixed" cellSpacing=0 width="100%" border=0>
<TBODY>
<TR>
<TD style="LEFT: 0px; WIDTH: 100%; WORD-WRAP: break-word"><SPAN id=BlogBody_BlogArticleView_lbContent><PRE><PRE><PRE><PRE><P>groovy虽然没有自己的IDE，但是它可以依附在很多现有的开发环境如eclipse，intelli idea等。不过不巧我都不大用这些开发环境的。还好，找到了<A href="http://docs.codehaus.org/download/attachments/23080/wordfile-groovy.txt?version=1"><U><FONT color=#0000ff>groovy的ultraedit语法文件</FONT></U></A> 这样在ultraedit下面也可以高亮显示、编译和运行groovy了。 <BR><BR> <BR></P><P><BR>ultraedit甚至还提供了命令自动补全功能，不过默认使用的组合键是ctrl+space，恰好和输入法切换键冲突了。不过我们可以修改组合键：<BR></P><P><BR>Advanced - Configuration - Key Mapping <BR></P><P><BR>在commands里面找到AutoComplete（命令不是按字母排序的，按一下“A”键就自动找到啦），然后输入焦点转到 Press New Key框中，选择自己喜欢的组合键，比如 Alt+space，确认组合键出现在框里面后点一下Assign键，大功告成。<BR></P><P><BR>详细介绍见 <A href="http://groovy.codehaus.org/UltraEdit+Plugin"><U><FONT color=#800080>http://groovy.codehaus.org/UltraEdit+Plugin</FONT></U></A><BR></P><P><BR>editplus也是我心爱的编辑器之一，还好不只我喜欢editplus和groovy，有个韩国网站也有同好：<A href="http://www.javaclue.org/index.jsp"><U><FONT color=#800080>http://www.javaclue.org/index.jsp</FONT></U></A><BR></P><P><BR>看不懂:-P。不过也不用看懂，直接把他们写的groovy语法文件<BR><BR> <BR><BR><BR><BR><BR><BR><BR><A href="http://www.javaclue.org/groovy/editor/editplus/groovy.acp"><U><FONT color=#800080>http://www.javaclue.org/groovy/editor/editplus/groovy.acp</FONT></U></A><BR><BR>&nbsp;和<BR><BR> <A href="http://www.javaclue.org/groovy/editor/editplus/groovy.stx"><U><FONT color=#800080>http://www.javaclue.org/groovy/editor/editplus/groovy.stx</FONT></U></A><BR><BR> <BR><BR><BR><BR>下载下来，在editplus的参数选项－－设置和语法里面添加groovy的语法和自动补全文件，现在editplus也支持groovy的高亮显示和自动补全了。<BR><BR> <BR><BR><BR><BR>不过editplus的自动补全和ultraedit有写不同，是敲一个关键字，然后按空格的时候把相关的语法元素自动补进来。<BR><BR> </P><P>如果韩国网站访问不到也可以到<A href="http://www.blogjava.net/Files/emu/groovy.editplus.rar"><U><FONT color=#0000ff>这里</FONT></U></A>下这两个语法文件。</P></PRE></PRE></PRE><P></P></PRE></SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><img src ="http://www.blogjava.net/emu/aggbug/4781.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/emu/" target="_blank">emu</a> 2005-05-18 17:55 <a href="http://www.blogjava.net/emu/archive/2005/05/18/4781.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>groovy学习笔记1 －从HelloWorld到八皇后 </title><link>http://www.blogjava.net/emu/archive/2005/05/18/4780.html</link><dc:creator>emu</dc:creator><author>emu</author><pubDate>Wed, 18 May 2005 09:50:00 GMT</pubDate><guid>http://www.blogjava.net/emu/archive/2005/05/18/4780.html</guid><wfw:comment>http://www.blogjava.net/emu/comments/4780.html</wfw:comment><comments>http://www.blogjava.net/emu/archive/2005/05/18/4780.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/emu/comments/commentRss/4780.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/emu/services/trackbacks/4780.html</trackback:ping><description><![CDATA[<TABLE style="BORDER-COLLAPSE: collapse" width="95%" border=0>
<TBODY>
<TR>
<TD class=BlogArticleTitle></TD></TR>
<TR>
<TD class=BlogArticleContent>
<TABLE style="TABLE-LAYOUT: fixed" cellSpacing=0 width="100%" border=0>
<TBODY>
<TR>
<TD style="LEFT: 0px; WIDTH: 100%; WORD-WRAP: break-word"><SPAN id=BlogBody_BlogArticleView_lbContent><PRE><P><PRE><P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">网上看到很多评论说</SPAN><SPAN lang=EN-US><A href="http://groovy.codehaus.org/"><U><FONT face="Times New Roman" color=#800080>groovy</FONT></U></A><FONT face="Times New Roman"> </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是个很好用的脚本语言，周末去下了一个回来看看。语法好像和</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">java</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">有些接近，不过松散了一些，有好也有坏吧。遗憾的是没有</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">IDE</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，只好在</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">editplus</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">上面配了个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">groovy</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">工具组，添了运行、编译和控制台三个命令进去，然后开始照着手册敲代码。</SPAN></FONT></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p><FONT face="Times New Roman" size=3>&nbsp;</FONT></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">读书的时候就换过好几次开发语言，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">LOGO, BASIC (</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">APPLE II </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">上面的那种呵呵</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">), TRUE BASIC, QUICK BASIC, TURBO PASCAL, TURBO C, TPW, BC++, DELPHI</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">每次换一种语言总是这样几个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">step</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：</SPAN></FONT></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN lang=EN-US><FONT face="Times New Roman">1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><FONT face="Times New Roman"> <SPAN lang=EN-US>hello world</SPAN></FONT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（看看开发环境）</SPAN><FONT face="Times New Roman"> <SPAN lang=EN-US>2</SPAN></FONT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><FONT face="Times New Roman"> <SPAN lang=EN-US>99</SPAN></FONT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">乘法表（看看循环、格式化输出）</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">3 </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">做个比较复杂点的程序，看看过程调用、循环、判断这些基本的语言特征。</SPAN></FONT></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p><FONT face="Times New Roman" size=3>&nbsp;</FONT></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT size=3>好些年没有学新语言了，还是先试试这三板过时的（面向对象、数据库、网络服务都没有涉及到）斧头还能不能砍得了东西吧。</FONT></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman" size=3>1 hello world</FONT></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">脚本语言就是方便，一点上下文都没有，一个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">println</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">就搞定了</SPAN></FONT></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p><FONT face="Times New Roman" size=3>&nbsp;</FONT></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN lang=EN-US><FONT face="Times New Roman">2 99</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">乘法表</SPAN></FONT></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT size=3><FONT face="Times New Roman"></P><DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"><DIV><SPAN style="COLOR: #008080">&nbsp;1</SPAN><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">def&nbsp;i</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;2</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>def&nbsp;j<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;3</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_25_104_Open_Image onclick="this.style.display='none'; Codehighlighter1_25_104_Open_Text.style.display='none'; Codehighlighter1_25_104_Closed_Image.style.display='inline'; Codehighlighter1_25_104_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_25_104_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_25_104_Closed_Text.style.display='none'; Codehighlighter1_25_104_Open_Image.style.display='inline'; Codehighlighter1_25_104_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">(i</SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">9</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN id=Codehighlighter1_25_104_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_25_104_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;4</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;i</SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;5</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;j</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;6</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_49_91_Open_Image onclick="this.style.display='none'; Codehighlighter1_49_91_Open_Text.style.display='none'; Codehighlighter1_49_91_Closed_Image.style.display='inline'; Codehighlighter1_49_91_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_49_91_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_49_91_Closed_Text.style.display='none'; Codehighlighter1_49_91_Open_Image.style.display='inline'; Codehighlighter1_49_91_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">(j</SPAN><SPAN style="COLOR: #000000">&lt;=</SPAN><SPAN style="COLOR: #000000">i)</SPAN><SPAN id=Codehighlighter1_49_91_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_49_91_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(j</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">i</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">(i</SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000">j)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">\t</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">)<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;j</SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;9</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;println()<BR></SPAN><SPAN style="COLOR: #008080">11</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN></DIV></DIV><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"></FONT></FONT></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">脚本语言就是松散，分号加不加都可以。语法和数据类型好像都跟</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">java</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">差不多。</SPAN></FONT></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p><FONT face="Times New Roman" size=3>&nbsp;</FONT></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN lang=EN-US><FONT face="Times New Roman">3 </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">写个复杂一点的例子。前两天看</SPAN><SPAN lang=EN-US><A href="http://community.csdn.net/Expert/topic/3881/3881210.xml"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><U><FONT color=#0000ff>《程序员法则》</FONT></U></SPAN></A></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">刚好看到提起了著名的八皇后问题，就写个八皇后吧：</SPAN></FONT></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p><FONT face="Times New Roman" size=3></FONT></o:p></SPAN></P><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT size=3><P></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"></P><DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"><DIV><SPAN style="COLOR: #008080">&nbsp;1</SPAN><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">&nbsp;q</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">8</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;2</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">[]&nbsp;i</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">[q]<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;3</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">&nbsp;count</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;4</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">long</SPAN><SPAN style="COLOR: #000000">&nbsp;t&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;System.currentTimeMillis();<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;5</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>scan(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">)<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;6</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>println(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">totle&nbsp;results:</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">count)<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>println(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">totle&nbsp;time:</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">(System.currentTimeMillis()</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">t));<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_182_312_Open_Image onclick="this.style.display='none'; Codehighlighter1_182_312_Open_Text.style.display='none'; Codehighlighter1_182_312_Closed_Image.style.display='inline'; Codehighlighter1_182_312_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_182_312_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_182_312_Closed_Text.style.display='none'; Codehighlighter1_182_312_Open_Image.style.display='inline'; Codehighlighter1_182_312_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top>def&nbsp;scan(n)</SPAN><SPAN id=Codehighlighter1_182_312_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_182_312_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;9</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_194_238_Open_Image onclick="this.style.display='none'; Codehighlighter1_194_238_Open_Text.style.display='none'; Codehighlighter1_194_238_Closed_Image.style.display='inline'; Codehighlighter1_194_238_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_194_238_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_194_238_Closed_Text.style.display='none'; Codehighlighter1_194_238_Open_Image.style.display='inline'; Codehighlighter1_194_238_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(n</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000">q)</SPAN><SPAN id=Codehighlighter1_194_238_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_194_238_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;println(i.toList())<BR></SPAN><SPAN style="COLOR: #008080">11</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count</SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">13</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">14</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;i[n]</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">15</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_262_310_Open_Image onclick="this.style.display='none'; Codehighlighter1_262_310_Open_Text.style.display='none'; Codehighlighter1_262_310_Closed_Image.style.display='inline'; Codehighlighter1_262_310_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_262_310_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_262_310_Closed_Text.style.display='none'; Codehighlighter1_262_310_Open_Image.style.display='inline'; Codehighlighter1_262_310_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">(i[n]</SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">q)</SPAN><SPAN id=Codehighlighter1_262_310_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_262_310_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">16</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i[n]&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;i[n]</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">17</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(check(n))<BR></SPAN><SPAN style="COLOR: #008080">18</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scan(n</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">)<BR></SPAN><SPAN style="COLOR: #008080">19</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">20</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">21</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_326_444_Open_Image onclick="this.style.display='none'; Codehighlighter1_326_444_Open_Text.style.display='none'; Codehighlighter1_326_444_Closed_Image.style.display='inline'; Codehighlighter1_326_444_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_326_444_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_326_444_Closed_Text.style.display='none'; Codehighlighter1_326_444_Open_Image.style.display='inline'; Codehighlighter1_326_444_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top>def&nbsp;check(n)</SPAN><SPAN id=Codehighlighter1_326_444_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_326_444_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">22</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(n</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">)<BR></SPAN><SPAN style="COLOR: #008080">23</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">for</SPAN><SPAN style="COLOR: #000000">&nbsp;(j&nbsp;</SPAN><SPAN style="COLOR: #0000ff">in</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">..</SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">n)&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">24</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(i[j]</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000">i[n]&nbsp;</SPAN><SPAN style="COLOR: #000000">||</SPAN><SPAN style="COLOR: #000000">&nbsp;i[j]</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">i[n]</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000">j</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">n&nbsp;</SPAN><SPAN style="COLOR: #000000">||</SPAN><SPAN style="COLOR: #000000">&nbsp;i[j]</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">i[n]</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000">n</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">j&nbsp;)<BR></SPAN><SPAN style="COLOR: #008080">25</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">false</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">26</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">27</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN></DIV></DIV><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><BR><BR>呵呵，典型的面向过程，全局变量都弄出来了。运行一下还满快的。</FONT></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p><FONT face="Times New Roman" size=3>&nbsp;</FONT></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT size=3>在blogjava贴程序的时候groovy的一个语言符号“...”（23行）被替换成图片了，不过本来这个符号也已经开始被淘汰了，用“..&lt;”</FONT></SPAN></P></PRE></PRE></SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><img src ="http://www.blogjava.net/emu/aggbug/4780.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/emu/" target="_blank">emu</a> 2005-05-18 17:50 <a href="http://www.blogjava.net/emu/archive/2005/05/18/4780.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>