計(jì)算機(jī)英語(yǔ):BASIC語(yǔ)言變量

字號(hào):

BASIC Variables
    BASIC is designed to allow simple programs to be developed quickly,and is widely used on micro-computers.There are many versions of BASIC:However an ANSI standard does exist. Most versions are interpreted interactively, with, statements checked as they are typed in.
    The end of a line serves to delimit declarations and statements.Colons can be used in most versions of BASIC to separate statements on the same line. All lines have to be numbered, and these numbers serves labels used as the destination of GOTO and GOSUB (subroutine call) statements.Standard BASIC allows up to two characters to be used as identifiers:a letter followed by a digit. Comments are prefixed by REM (for remark).
    Types available vary with different versions.On the PET personal computer, there are point floating numbers (the default assumption for an identifier),integers (identifiers ending in%)and strings(identifiers ending in$).Variables of these types don’t have to be declared-, numbers have value()NN-handiest used, strings are null when first used . Howe herewith BASIC on some machines. variables do not have default initialization and an error is indicated if one tries to use an undefined variable.Explicit type con-version is possible, e.g. VAL converts a string representing a number to that number. Multi -dimensional arrays are static and declared using DIM.There are no records.
    翻譯:
    BASIC語(yǔ)言變量
    BASIC語(yǔ)言設(shè)計(jì)得允許迅速開(kāi)發(fā)簡(jiǎn)絡(luò)程序,同時(shí)它也被廣泛地用到微機(jī)土。BASIC語(yǔ)言有許多版本,但的確存在著一種ANSI標(biāo)準(zhǔn)文本。大多數(shù)版本的BASIC語(yǔ)言,當(dāng)其語(yǔ)句被鍵入時(shí),該語(yǔ)句一邊被檢查,一邊被交互地解釋。
    行結(jié)束符是用來(lái)給說(shuō)明及語(yǔ)句定界的,大多數(shù)BASIC的版本中, 冒號(hào)被用來(lái)將同一行的語(yǔ)句分開(kāi)。 所有的行均必須加以編號(hào),這些編號(hào)被用作GOTO和GOSUB(一子程序 調(diào)用)語(yǔ)句的目的地的標(biāo)號(hào)。標(biāo)準(zhǔn)的BASIC允許用多達(dá)二個(gè)字符作為 標(biāo)識(shí)符:一個(gè)字母后跟一位數(shù)字, 注釋前面冠有REM(注釋?zhuān)?biāo)志。
    可用的變量類(lèi)型隨版本不同而 各異。在PET個(gè)人計(jì)算機(jī)中,有浮點(diǎn) 數(shù)型(缺省值假定為某一標(biāo)識(shí) 符)、整型〔標(biāo)識(shí)符用%來(lái)結(jié)尾〕和 字符串型(標(biāo)識(shí)符用¥)。若這些 類(lèi)型的變量末被說(shuō)明,則當(dāng)它們第 一次被用到時(shí),數(shù)字值為O,字符串則為空。但是,在某些機(jī)器的BASIC中,變量并沒(méi)有缺省值初始 化,如果有誰(shuí)試圖使用一個(gè)未加定義的變量的話(huà),機(jī)器將批示為錯(cuò)誤。類(lèi)型的簡(jiǎn)易轉(zhuǎn)換是可能的,如VAL可將代表一個(gè)數(shù)的串轉(zhuǎn)換為該 數(shù)。多維數(shù)組是靜態(tài)的,DIM利用 加以說(shuō)明,BASIC中沒(méi)有一記錄。