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

Slides/2 problems found from pat #456

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions courses/fundamentals_of_ada/030_basic_types/07-real_types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ What is the output of this code?
Put_Line (Float'Image (F));
end;

A. 7.6
A. 7.6E-01
B. Compile Error
C. 8.0
C. 8.0E-01
D. :answer:`0.0`

.. container:: animate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Aliasing the Assignment Target
// becomes
total += value;

* Ada 2022 implements this by using the target name symbol **@**
* Ada 2022 implements this by using the target name symbol :ada:`@`

.. code:: Ada

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ D. | ``end if;``
Explanations

* :ada:`A` uses the C-style equality/inequality operators
* :ada:`D` is legal because :ada:`else` is not required
* :ada:`D` is legal because :ada:`else` is not required for an :ada:`if` block

------
Quiz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ Supplying Index Constraints for Objects

.. code:: Ada

Weekdays(Sat) := 0.0; -- Compiler error
Weekend(Mon) := 0.0; -- Compiler error
Weekdays(Sat) := 0.0; -- Constraint error
Weekend(Mon) := 0.0; -- Constraint error

---------------------------------------
Bounds Must Satisfy Type Constraints
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ When to Avoid Private Types
type Vector is array (Positive range <>) of Float;
V : Vector (1 .. 3);
...
V (1) := Alpha;
V (1) := Alpha; -- Illegal since Vector is private

24 changes: 12 additions & 12 deletions courses/fundamentals_of_ada/labs/030_basic_types.lab.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,18 @@ Basic Types Lab Hints
.. code:: Ada

<typemark>'Image (Object)
Object'Image
Object'Image

--------------------------
Basic Types Extra Credit
--------------------------

* See what happens when your data is invalid / illegal

- Number of tests = 0
- Assign a very large number to the test score total
- Color type only has one value
- Add a number larger than 360 to the circle value

----------------------------------------
Basic Types Lab Solution - Declarations
Expand All @@ -83,14 +94,3 @@ Basic Types Lab Solution - Implementation

.. container:: source_include labs/answers/030_basic_types.txt :start-after:--Implementation :end-before:--Implementation :code:Ada :number-lines:18

--------------------------
Basic Types Extra Credit
--------------------------

* See what happens when your data is invalid / illegal

- Number of tests = 0
- Assign a very large number to the test score total
- Color type only has one value
- Add a number larger than 360 to the circle value

Loading