From 9e9d5edf816b3fa0c0ecda480279780e4ccf6726 Mon Sep 17 00:00:00 2001 From: eiffel-org Date: Wed, 13 Jun 2018 08:13:46 +0000 Subject: [PATCH] update code to use back ticks. Updated wikipage Manifest array. (Signed-off-by:jocelyn). git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@2038 abb3cda0-5349-4a8f-a601-0c33ac3a8c38 --- .../Expressions/Manifest-array.wiki | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/documentation/18.01/eiffel/Language_reference/quick-reference-eiffel-programming-language/Expressions/Manifest-array.wiki b/documentation/18.01/eiffel/Language_reference/quick-reference-eiffel-programming-language/Expressions/Manifest-array.wiki index 4db08d68..b57687c8 100644 --- a/documentation/18.01/eiffel/Language_reference/quick-reference-eiffel-programming-language/Expressions/Manifest-array.wiki +++ b/documentation/18.01/eiffel/Language_reference/quick-reference-eiffel-programming-language/Expressions/Manifest-array.wiki @@ -2,9 +2,9 @@ [[Property:weight|0]] [[Property:title|Manifest array]] -A manifest array is an expression denoting an array by simply listing its elements, as in <<1, 4, 9, 16, 25>>. The lower index is always 1 and the upper index is the number of items, 5 in this example. +A manifest array is an expression denoting an array by simply listing its elements, as in `<<1, 4, 9, 16, 25>>`. The lower index is always `1` and the upper index is the number of items, `5` in this example. -The type of a manifest array is always ARRAY [T] where T is a type to which all the elements conform, INTEGER in the previous example. In case of a possible ambiguity you can make the type explicit, as in {ARRAY [COMPARABLE]} <<7, "Eiffel">>, where both INTEGER, the type of 7, and STRING, the type of "Eiffel", conform to COMPARABLE. +The type of a manifest array is always `ARRAY [T]` where `T` is a type to which all the elements conform, `INTEGER` in the previous example. In case of a possible ambiguity you can make the type explicit, as in `{ARRAY [COMPARABLE]} <<7, "Eiffel">>`, where both `INTEGER`, the type of `7`, and `STRING`, the type of `"Eiffel"`, conform to `COMPARABLE`. == What are manifest arrays good for? == @@ -14,7 +14,7 @@ Use a manifest array to initialize an element by simply listing its initial elem squares: ARRAY [INTEGER] ``` -you can initialize squares through +you can initialize `squares` through ```eiffel squares := <<1, 4, 9, 16, 25>> @@ -43,25 +43,25 @@ which will resize the array to bounds 1 and 6. If you do not explicitly specify an array type, the type of the manifest array is as follows: -* For an empty manifest array <<>>: ARRAY [NONE]. (In the following cases we assume the array is not empty.) +* For an empty manifest array `<<>>`: `ARRAY [NONE]`. (In the following cases we assume the array is not empty.) -* If all elements are of the same exact type T: ARRAY [T]. +* If all elements are of the same exact type `T`: `ARRAY [T]`. -* If the types of all elements all conform to a type T: ARRAY [T]. Note that in this case T is unique since two different types cannot conform to each other. (The preceding case, all types identical, is a special case of this one, since a type conforms to itself.) +* If the types of all elements all conform to a type `T`: `ARRAY [T]`. Note that in this case `T` is unique since two different types cannot conform to each other. (The preceding case, all types identical, is a special case of this one, since a type conforms to itself.) -* Otherwise: ARRAY [ANY]. +* Otherwise: `ARRAY [ANY]`. -As an example of the third case (conformance of all elements to one of them), assume POLYGON and CIRCLE both conform to FIGURE. Then the manifest array <>, with a_polygon of type POLYGON and so on, is ARRAY [FIGURE]. +As an example of the third case (conformance of all elements to one of them), assume `POLYGON` and `CIRCLE` both conform to `FIGURE`. Then the manifest array `<>`, with `a_polygon` of type `POLYGON` and so on, is `ARRAY [FIGURE]`. == Type of a manifest array: the explicit case == -With the preceding rule, the type of <<7, "Eiffel">> is the most general possible one, ARRAY [ANY], since INTEGER and STRING do not conform to each other (either way). If you are not happy with this default type, you can make the array type explicit by writing it in braces: +With the preceding rule, the type of `<<7, "Eiffel">>` is the most general possible one, `ARRAY [ANY]`, since `INTEGER` and `STRING` do not conform to each other (either way). If you are not happy with this default type, you can make the array type explicit by writing it in braces: ```eiffel {ARRAY [COMPARABLE]} <<7, "Eiffel">> ``` -The rule in such a case is that in {ARRAY [T]} <> the types of all elements must conform to T. +The rule in such a case is that in `{ARRAY [T]} <>` the types of all elements must conform to `T`. As another example, with @@ -69,13 +69,13 @@ As another example, with figures: ARRAY [FIGURE] ``` -you cannot assign <> to figures since the type of the manifest array is ARRAY [ANY]. To make this assignment possible, use an explicit type: +you cannot assign `<>` to `figures` since the type of the manifest array is `ARRAY [ANY]`. To make this assignment possible, use an explicit type: ```eiffel figures := {ARRAY [FIGURE]} <> ``` -You can also use this form to give an explicit type to an empty array, which would otherwise be of type ARRAY [NONE]. For example, with figures declared as above: +You can also use this form to give an explicit type to an empty array, which would otherwise be of type `ARRAY [NONE]`. For example, with `figures` declared as above: ```eiffel figures := {ARRAY [FIGURE]} <<>>