我目前正在从learn.adacore.com开始进行Ada教程,现在是第二个示例:读取并输出一个整数。由于复制粘贴适用于不想学习语法的人,因此我手动输入了大部分代码(其中一些代码是由gnat-gps生成的,但是我现在使用的是vim)。
我编译并运行了该程序,令人惊讶的是,输出的第二行大约缩进了一个制表符。为什么?
代码如下:
With Ada.Text_IO;
Use Ada.Text_IO;
With Ada.Integer_Text_IO;
use Ada.Integer_Text_IO;
procedure Main is
N : Integer;
begin
-- Insert code here.
Put("Enter an integer value: ");
Get(N);
if N>0 then
Put (N);
Put_Line(" is a positive number");
end if;
end Main;
(如何突出显示语法?)
以下是输出示例(第一个输入):
Enter an integer value: 1
1 is a positive number