–break
退出循环
退出“for”和“while”循环。
示例:
for i 1 10
yesnobox 'quit from loop?' 'Tera Term'
if result break
next
while 1
recvln
strcompare inputstr "OK"
if result=0 then
break
else
sendln "abc..."
endif
endwhile
–call
call <label>
调用子程序。
示例:
:sub
messagebox "Now I'm in sub" "test"
return
messagebox "I'm in main." "test"
call sub
messagebox "Now I'm in main" "test"
end
–continue
将控制立即转移到循环的下一次迭代。
示例:
a=0
b=0
while a<5
a=a+1
if a>2 then
continue
endif
b=b+1
endwhile
sprintf2 var "a=%d b=%d" a b
dispstr var
;a=5 b=2
–do, loop
循环
示例:
; Repeat ten times.
i = 10
do while i>0
i = i - 1
loop
; Send clipboard content.
offset = 0
do
clipb2var buff offset
if buff > 0 send buff
offset = offset + 1
loop while result = 2
–end
end
退出宏的执行。
– execcmnd
execcmnd <statement>
执行ttl 命令
–exit
返回到主文件。
–for, next
; Repeat ten times.
for i 1 10
sendln 'abc'
next
; Repeat five times.
for i 5 1
sendln 'abc'
next
–goto
goto <label>
跳转到一个标签,
; Jump to the next line of the ':label'.
goto label
...
...
...
:label
send 'abc'
–if, then, elseif, else, endif
if a=1 then
b = 1
c = 2
d = 3
endif
if i<0 then
i=0
else
i=i+1
endif
if i=1 then
c = '1'
elseif i=2 then
c = '2'
elseif i=3 then
c = '3'
else
c = '?'
endif
–include
include '<include file name>'
将控制移动到包含文件。
–mpause
mpause
暂停,后续时间是以ms为单位
–pause
pause
暂停,后续时间是以s为单位
–return
退出子例程并返回到主例程。
–until, enduntil
示例:
; Repeat ten times.
i = 1
until i > 10
i = i + 1
enduntil
–while, endwhile
示例:
; Repeat ten times.
i = 10
while i>0
i = i - 1
endwhile