R/MRatCalcpowered by RiX

RiX walkthrough 3

Collections and text

Choose arrays, strings, tuples, maps, and sets for different kinds of data.

Start with a list

An array holds values in order. Its first item has index 1, and duplicate values remain separate.

Runnable RiX

The answer is the exact rational 7/4, which the browser may display as a mixed number. Change the second entry and rerun the cell. Arrays explains reading and making a revised array.

Choose a shape

Text values use quotation marks. A tuple uses {: ... } for a small positional group. A map names entries. A set retains distinct values.

Runnable RiX

The result reads as b, 3, 24, and true. The set stores bolt once even though it appears twice in the literal. Read Strings and tuples, Maps, and Sets when you need each form.

For a first program, arrays and strings are enough; maps, sets and shaped values can wait until a task calls for them. Shaped values handles rectangular data, and Exact inventory combines several collection shapes after you have tried their focused lessons.

Continue with Decisions and blocks to choose what to do with a value.