培基者(BASIC也),解釋編程語言也。初行於耶歷一九六四,纂後毋須編譯,解釋可行也。
若夫此類,蓋句首行號也。解釋器依行號而行,順勢而下,然世人詬以行號,以為麵條。
10 INPUT "爾何名: ", U$ 20 PRINT "無恙 "; U$ 30 INPUT "爾欲星幾何: ", N 40 S$ = "" 50 FOR I = 1 TO N 60 S$ = S$ + "*" 70 NEXT I 80 PRINT S$ 90 INPUT "其餘? ", A$ 100 IF LEN(A$) = 0 THEN GOTO 90 110 A$ = LEFT$(A$, 1) 120 IF A$ = "Y" OR A$ = "y" THEN GOTO 30 130 PRINT "請歸 "; U$ 140 END
若夫此類,行號更易,標籤代之。
INPUT "爾何名: ", UserName$ PRINT "無恙 "; UserName$ DO INPUT "爾欲星幾何 ", NumStars Stars$ = STRING$(NumStars, "*") PRINT Stars$ DO INPUT "其餘? ", Answer$ LOOP UNTIL Answer$ <> "" Answer$ = LEFT$(Answer$, 1) LOOP WHILE UCASE$(Answer$) = "Y" PRINT "請歸 "; UserName$
若夫此類,編譯器代之以解釋器,自立可行。
Public Class StarsProgram Public Shared Sub Main() Dim UserName, Answer, stars As String, NumStars As Integer Console.Write("爾何名: ") 簿名= Console.ReadLine() Console.WriteLine("無恙 {0}", 簿名) Do Console.Write("爾欲星幾何 ") 星之數 = CInt(Console.ReadLine()) 星 = New String("*", NumStars) Console.WriteLine(星) Do Console.Write("其餘? ") 答 = Console.ReadLine() Loop Until Answer <> "" 答 = 答.Substring(0, 1) Loop While 答.ToUpper() = "Y" Console.WriteLine("請歸 {0}", 簿名) End Sub End Class
This article uses material from the Wikipedia 古文 / 文言文 article 培基, which is released under the Creative Commons Attribution-ShareAlike 3.0 license ("CC BY-SA 3.0"); additional terms may apply (view authors). 若無側注,諸文皆奉CC BY-SA 4.0以行。 Images, videos and audio are available under their respective licenses.
®Wikipedia is a registered trademark of the Wiki Foundation, Inc. Wiki 古文 / 文言文 (DUHOCTRUNGQUOC.VN) is an independent company and has no affiliation with Wiki Foundation.