跳转到内容

TI-BASIC 68K/流程控制:修订间差异

计算器百科,非营利的计算器专业知识百科。
Dousha99留言 | 贡献
先挖个坑
 
Dousha99留言 | 贡献
无编辑摘要
 
第38行: 第38行:


=== If-Else-EndIf ===
=== If-Else-EndIf ===
B86 的条件跳转是通过 <pre>If-Else</pre> 方式实现的,示例如下:
<syntaxhighlight lang="basic">
:Local cond
:cond = false
:If cond Then
:  Disp "This line will not be executed"
:Else
:  Disp "Hello!"
:EndIf
</syntaxhighlight>


== 循环 ==
== 循环 ==

2019年3月9日 (六) 15:54的最新版本

此条目尚未完工。
此条目尚未完工。原作者将会继续进行编写,而您也可以对该条目进行编辑

无条件跳转

注意:请勿滥用 Goto 语句!

B68 的无条件跳转是由 Goto-Lbl 对实现的,其语法为:

Goto <标签名> Lbl <标签名>

标签名无需在 Goto 语句前声明。

需要注意到 Goto 仅能在程序内部进行跳转而无法调用其他程序。

接下来的例子将会演示无条件跳转:

example()
:Prgm
:Goto here
:Disp "This line will not be executed"
:Disp "Nor this line"
:Lbl here
:Disp "Hello!"
:EndPrgm

输出:

Hello!

条件跳转

If-Else-EndIf

B86 的条件跳转是通过

If-Else

方式实现的,示例如下:

:Local cond
:cond = false
:If cond Then
:  Disp "This line will not be executed"
:Else
:  Disp "Hello!"
:EndIf

循环

For-EndFor

Loop-EndLoop

While-EndWhile