7. Example
Output generated with Examples.jl based on this source file.
This is an example source file for input to Examples.jl.
If you are reading this you are seeing the markdown output generated from the source file, here you can see the corresponding notebook output: example.ipynb
Rational numbers in Julia
Rational number in julia can be constructed with the // operator:
x = 1//3
y = 2//52//5Operations with rational number returns a new rational number
x + y11//15x * y2//15Everytime a rational number is constructed, it will be simplified using the gcd function, for example 2//4 simplifies to 1//2:
2//41//2and 2//4 + 2//4 simplifies to 1//1:
2//4 + 2//41//1