Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add really basic Ada implementation #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions definitely-production-grade/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CC := gcc

all: fizzbuzz

%.o: %.adb
$(CC) -c $<

%: %.adb %.o
gnatmake $<
21 changes: 21 additions & 0 deletions definitely-production-grade/fizzbuzz.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
with Ada.Text_IO; use Ada.Text_IO;

procedure FizzBuzz is
procedure Core (N : Integer)
is -- todo: leverage spark
begin
if N mod 15 = 0 then
Ada.Text_IO.Put_Line ("FizzBuzz");
elsif N mod 5 = 0 then
Ada.Text_IO.Put_Line ("Buzz");
elsif N mod 3 = 0 then
Ada.Text_IO.Put_Line ("Fizz");
else
Ada.Text_IO.Put_Line (N'Image);
end if;
end Core;
begin
for I in 1 .. 100 loop
Core (I);
end loop;
end FizzBuzz;