Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,6 @@ Introduction
..
language_version 2012

----------
Examples
----------

.. code:: ada

with GNAT.Random_Numbers; use GNAT.Random_Numbers;
with Ada.Text_IO; use Ada.Text_IO;
procedure Quantified_Expressions is
Gen : Generator;
Values : constant array (1 .. 10) of Integer := (others => Random (Gen));

Any_Even : constant Boolean := (for some N of Values => N mod 2 = 0);
All_Odd : constant Boolean := (for all N of reverse Values => N mod 2 = 1);

function Is_Sorted return Boolean is
(for all K in Values'Range =>
K = Values'First or else Values (K - 1) <= Values (K));

function Duplicate return Boolean is
(for some I in Values'Range =>
(for some J in I + 1 .. Values'Last => Values (I) = Values (J)));

begin
Put_Line ("Any Even: " & Boolean'Image (Any_Even));
Put_Line ("All Odd: " & Boolean'Image (All_Odd));
Put_Line ("Is_Sorted " & Boolean'Image (Is_Sorted));
Put_Line ("Duplicate " & Boolean'Image (Duplicate));
end Quantified_Expressions;
.. include:: ../examples/080_expressions/quantified_expressions.rst

-----------------------------------------
Semantics Are As If You Wrote This Code
-----------------------------------------
Expand Down
Loading