LoginSignup
0
0

More than 5 years have passed since last update.

Ada言語 8日目 for文

Last updated at Posted at 2018-12-20

はじめに

今回はループをやりました。for文を使いました。
面白いことにAda言語ではC言語ではなかったreverseという機能がありましたのでそれもやってみました。

ソースと結果

main.adb

with Ada.Integer_Text_IO;
use Ada.Integer_Text_IO;

procedure main is

    hennsuu : Integer := 0;

begin

    for hennsuu in 1 .. 5 loop
        Ada.Integer_Text_IO.Put(hennsuu, 1);
    end loop;

    hennsuu := 0;
    Ada.Integer_Text_IO.Put(hennsuu, 1);

    for hennsuu in reverse 1 .. 5 loop
        Ada.Integer_Text_IO.Put(hennsuu, 1);
    end loop;

end main;

実行結果 : 12345054321

最後に

1から5までというfor文に対して、reverseという機能を使うと、5から1になるようです。

日記一覧へ

Ada言語を習得する日記一覧

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0