This project is read-only.
#示例代码如下





  1. while ,break, continue 测试
println("while ,break, continue 测试")
int testwhile=0
while testwhile<5
testwhile=testwhile+1
if testwhile<=3 then
#break
println("Break:testwhile "+testwhile)
elseif testwhile == 4
println("Break:elseif,continue")
continue
else
println("Break:else,break")
break
endif
endwhile

println()
println()
println()
println()

  1. 方法的调用
int count
func Test(int a,string b,bool t)

while count<5
count=count+1
break
while count<3
println("count的inner值:"+count)
count=count+1
endwhile
println("count的内部值:"+count)
endwhile
println("t的内部值:"+t)
return count
endfunc
int a


println("方法的调用 func Test")
println("调用前,count的外部值:"+count)
a=Test(1,"ddd",false)
println("调用后,count的外部值:"+count)
print("a的值:")
println(a)
println()
println()
println()
println()
  1. 对系统的类的调用
println("对系统的类的调用")
object sys
sys=getClass("System.Console")

sys.WriteLine("cx")

string u = user.School.SchoolName
println("SchoolName的先前值:"+u)
string u2=user.School.SchoolName
println("SchoolName的后来值:"+u2)

user.Age="100"
string useAge =user.Age
println("user.Age的值:"+useAge)
user.School.SchoolName="hhhhh"
string clann = user.School.GetClassName(101)
println("ClassName的值:"+clann)

println()
println()
println()
println()
  1. 创建系统类
println("创建系统类")
object nArray = create("rs.data.NArray")
nArray.Put("aa")

int n_Count = nArray.Count
println("nArray的个数:"+n_Count)
println("nArray.Get(\"aa\"): "+nArray.Get(0))




println()
println()
println()
println()
  1. 调用标准库
println("调用标准库")
object date = getClass("System.DateTime")
println("当前时间: "+date.Now.ToString())
println("两天后的时间: "+date.Now.AddDays(2).ToString())
println()
println()
println()
println()
  1. 定义变量
println("")
println("定义变量")
int counter=0,b,c
string mypath="aaaaaaa"
string link,path="/home/"mypath"/my\ndir",tmpstring
println("counter "+counter)
println("path "+path)

if a<10
println("a>10")
elseif a <5
print("a<5")
else
print("a>10")
endif



println()
println()
println()
println()
  1. 用来测试for语句
println("用来测试for语句")
int t_for =0
while t_for<5
tfor=tfor+1
println("tfor: "+tfor)
for int i =1 to t_for
println("for: "+i)
endfor
endwhile
println()
  1. 用来测试for,step语句
println("用来测试for,step语句")
for int i =10 to 1 step -2
println("for: "+i)
endfor



println()
println()
println()
println()
# 变量作用域测试
println("变量作用域测试")
int w=2
int x=2
while w<3
while x<3
x=x+1
int k2 =11
if x>0 then

println("while if1: ")
break
endif
endwhile
int k2 =22
println("while k2: "+k2)
w=w+1
endwhile




for int i =10 to 1 step -2
int k1 =0
if i>0 then
int k2 =11
if i>0 then
if i>0 then
println("if1: ")
break
endif
println("if2: ")
endif
println("if3: ")
endif
endfor

func OutFun()
print("ttttt")
endfunc

Last edited Oct 29, 2009 at 5:29 AM by cxchen84xi, version 1

Comments

No comments yet.