How to resolve the algorithm Enumerations step by step in the Inform 7 programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Enumerations step by step in the Inform 7 programming language

Table of Contents

Problem Statement

Create an enumeration of constants with and without explicit values.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Enumerations step by step in the Inform 7 programming language

Source code in the inform programming language

Fruit is a kind of value. The fruits are apple, banana, and cherry.


[sentence form]
Fruit is a kind of value. The fruits are apple, banana, and cherry.
A fruit has a number called numeric value.
The numeric value of apple is 1.
The numeric value of banana is 2.
The numeric value of cherry is 3.


[table form]
Fruit is a kind of value. The fruits are defined by the Table of Fruits.

Table of Fruits
fruit	numeric value
apple	1
banana	2
cherry	3


  

You may also check:How to resolve the algorithm Leap year step by step in the LiveCode programming language
You may also check:How to resolve the algorithm Queue/Definition step by step in the Cowgol programming language
You may also check:How to resolve the algorithm Arbitrary-precision integers (included) step by step in the Quackery programming language
You may also check:How to resolve the algorithm Hello world/Standard error step by step in the zkl programming language
You may also check:How to resolve the algorithm Accumulator factory step by step in the Racket programming language