計(jì)算機(jī)英語:BASIC語言控制語句

字號(hào):

BASIC Control Statements
    Program control structures are primitive.Several forms of if statement man be available:
    ifgo to
    if then
    if
    where
    ::=|goto
    For arithmetic expressions a zero value can be treated as Boolean false,non-zero as true, Selection can also be performed by the on statement of the form:
    On goto
    If the expression evaluates to n, the nth statement number is selected for the destination of the GOTO.
    Iteration may be provided by a for statement and sometimes also by a repeat statement, otherwise the GOTO is require.
     Some versions of BASIC (including the standard) have subroutines (procedures and functions)with parameters.For others, control is simply passed to the start of a subroutine using GOSUB (instead of GOTO), and there is a [ENTER] statement to pass control back to the line below that of the GOSUB.
    BASIC is unsuitable for large programs,lacking modularization features.It can be criticized for user even in small programs,as there are other languages available which require explicit declarations and encourage better detailed structuring, giving rise to better programming style and hence more readable programs. Standardization has come too late to pre-vent a proliferation of incompatible implementations, compromising portability of programs;this must beset against the advantage of the wide availability of BASIC 。
    翻譯:
    BASIC語言控制語句
    程序控制結(jié)構(gòu)是原始的。if語句有幾種形式可用:
    if<表達(dá)式>goto<語句號(hào)(碼)>
    if<表達(dá)式>then<轉(zhuǎn)移>
    if<表達(dá)式>then(轉(zhuǎn)移)else<轉(zhuǎn)移>
    式中
    ::=<語句號(hào)(碼)>|goto<語句號(hào)(碼)>|
    對(duì)于算術(shù)表達(dá)式來說,一個(gè)零值可以作為布爾“假”來對(duì)待,而 非零值可作為布爾“真”來對(duì)待, 選擇也可由如形式on語句來實(shí)現(xiàn):
    on<表達(dá)式>goto<語句號(hào)(碼)表
    如果該表達(dá)式的值被定為m則 第n條語句號(hào)(碼)被選擇為GOTO的目的地。
    迭代可由for語句提供,有時(shí)也可由repeat語句提供,否則需要GOTO語句。
    有些BASIC的版本(包括標(biāo)準(zhǔn)版本)具有帶參數(shù)的子程序(過程及函數(shù))。對(duì)另一些版本來說,控制(轉(zhuǎn)移)是直接用GOSUB(代替GOTO)來 傳送給一個(gè)子程序的開始部的,還 有一個(gè)[ENTER]語句,用來將控制. (轉(zhuǎn)移)傳遞回GOSUB之下的那一 行。
    BASIC不適用于大型程序,區(qū)為它缺少模塊化特性。即使對(duì)小應(yīng)程序中的應(yīng)用,BASIC也可能會(huì)受到批評(píng),因?yàn)檫€有另一些語言可用,這些語言要求顯示說明,更好的詳細(xì)結(jié)構(gòu)化編程,以養(yǎng)成良好的編程風(fēng)格,從而編出更易讀色程序。標(biāo)準(zhǔn)化來得太晚,以致于天 能阻止不兼容的執(zhí)行過程的激增.這樣就損害了程序的可移植性,這與BASIC的廣泛的適用性的優(yōu)點(diǎn)是飛背道而馳的。這樣就損害了程序的可移植性,這 與BASIC的廣泛的適用性的優(yōu)點(diǎn)是 飛背道而馳的。