Course of Raku / Essentials / Numbers / Exercises / The value of π
Solution: The value of π
The program to print the value of π is simple enough.
Code
say π;
🦋 You can find the full code in the file pi.raku.
Output
Run the program and see what it prints:
$ raku exercises/numbers/pi.raku
3.141592653589793
Comments
Raku offers us a built-in constant called π
, which makes the program trivial. Nevertheless, consider other options for doing the same:
π.say;
Or:
pi.say;
Or:
say pi;
Next exercise
Course navigation
← Strings / String length | Boolean type →
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська