Course of Raku / Essentials / Creating and calling functions / Exercises

Function table

Problem

Create a program that prints the values of a function f(x) = x² on the interval [−3, 3] with step 0.1.

Example

The program should print a two-column output, where the value in the first column is x, and the value in the second column is f(x).

$ raku function-table.raku
-3	9
-2.9	8.41
-2.8	7.84
. . .

Solution

See the solution

Next exercise

💪 The value of e

Course navigation

Associative data types / Interpolating hashes   |   More about functions

Translations of this page: EnglishDeutschEspañolItalianoLatviešuNederlandsБългарскиРусскийУкраїнська