1
我剛開始學習BASIC和使用Stackoverflow。這是我在FBIDE的代碼。該錯誤信息是:Freebasic編譯失敗
42 variable not declared : var1 in 'input "Enter Function Number" ;var1/ - 32 expected 'END IF' found 'end' in 'end sub'/ - 32 expected 'END IF' in 'end sub' -
代碼:
declare sub premain
declare sub main
dim var1 as integer
premain
sub premain
print "EMC ALPHA v1.0"
main
end sub
sub main
print "Functions:"
print "1.Add"
print "2.Subtract"
print "3.Multiply"
print "4.Divide"
input "Enter Function Number" ;var1
if var1=1 then
print "HElo"
end sub
非常感謝。最後一個問題 - 如果(它是做什麼的)什麼是結束? – florosus
'END IF'用於結束一個有條件的程序部分塊。只有當條件(例如'var1 = 1)爲真時,纔會執行'IF ... THEN'和'END IF'之間的所有內容。看看這裏:http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgEndif – MrSnrub