7. Example
This is an example for Examples.jl. The source file can be found here. The generated markdown can be found here: example.md, the generated notebook can be found here: example.ipynb, and the plain script output can be found here: example.jl.
Rational numbers in Julia
Rational number in julia can be constructed with the // operator:
x = 1//3
+7. Example · Examples.jl
7. Example
This is an example for Examples.jl. The source file can be found here. The generated markdown can be found here: example.md, the generated notebook can be found here: example.ipynb, and the plain script output can be found here: example.jl.
Rational numbers in Julia
Rational number in julia can be constructed with the // operator:
x = 1//3
y = 2//5
2//5
Operations with rational number returns a new rational number
x + y
11//15
x * y
2//15
Everytime a rational number is constructed, it will be simplified using the gcd function, for example 2//4 simplifies to 1//2:
2//4
1//2
and 2//4 + 2//4 simplifies to 1//1:
2//4 + 2//4
1//1
diff --git a/latest/outputformats.html b/latest/outputformats.html
index 65dfc73..da40acf 100644
--- a/latest/outputformats.html
+++ b/latest/outputformats.html
@@ -17,4 +17,4 @@ Here is an example with some code
```@example
x = sin.(cos.([1, 2, 3]))
y = x.^2 - x
-```Examples.markdown — Function.Examples.markdown(inputfile, outputdir; kwargs...)Generate a markdown file from inputfile and write the result to the directoryoutputdir.
Keyword arguments:
name: name of the output file, excluding.md.nameis also used to name all the@exampleblocks. Defaults to the filename ofinputfile.preprocess,postprocess: custom pre- and post-processing functions, see the Custom pre- and post-processing section of the manual. Defaults toidentity.documenter: boolean that tells if the output is intended to use with Documenter.jl. Defaults totrue. See the the manual section on Interaction with Documenter.codefence: APairof opening and closing code fence. Defaults to
if"```@example $(name)" => "```"documenter = trueand
if"```julia" => "```"documenter = false.
4.2. Notebook output
Examples.notebook — Function.Examples.notebook(inputfile, outputdir; kwargs...)Generate a notebook from inputfile and write the result to outputdir.
Keyword arguments:
name: name of the output file, excluding.ipynb. Defaults to the filename ofinputfile.preprocess,postprocess: custom pre- and post-processing functions, see the Custom pre- and post-processing section of the manual. Defaults toidentity.execute: a boolean deciding if the generated notebook should also be executed or not. Defaults totrue.documenter: boolean that says if the source contains Documenter.jl specific things to filter out during notebook generation. Defaults totrue. See the the manual section on Interaction with Documenter.
4.3. Script output
Examples.script — Function.Examples.script(inputfile, outputdir; kwargs...)Generate a plain script file from inputfile and write the result to outputdir.
Keyword arguments:
name: name of the output file, excluding.jl. Defaults to the filename ofinputfile.preprocess,postprocess: custom pre- and post-processing functions, see the Custom pre- and post-processing section of the manual. Defaults toidentity.
Examples.markdown — Function.Examples.markdown(inputfile, outputdir; kwargs...)Generate a markdown file from inputfile and write the result to the directoryoutputdir.
Keyword arguments:
name: name of the output file, excluding.md.nameis also used to name all the@exampleblocks. Defaults to the filename ofinputfile.preprocess,postprocess: custom pre- and post-processing functions, see the Custom pre- and post-processing section of the manual. Defaults toidentity.documenter: boolean that tells if the output is intended to use with Documenter.jl. Defaults totrue. See the the manual section on Interaction with Documenter.codefence: APairof opening and closing code fence. Defaults to
if"```@example $(name)" => "```"documenter = trueand
if"```julia" => "```"documenter = false.
4.2. Notebook output
Examples.notebook — Function.Examples.notebook(inputfile, outputdir; kwargs...)Generate a notebook from inputfile and write the result to outputdir.
Keyword arguments:
name: name of the output file, excluding.ipynb. Defaults to the filename ofinputfile.preprocess,postprocess: custom pre- and post-processing functions, see the Custom pre- and post-processing section of the manual. Defaults toidentity.execute: a boolean deciding if the generated notebook should also be executed or not. Defaults totrue.documenter: boolean that says if the source contains Documenter.jl specific things to filter out during notebook generation. Defaults totrue. See the the manual section on Interaction with Documenter.
4.3. Script output
Examples.script — Function.Examples.script(inputfile, outputdir; kwargs...)Generate a plain script file from inputfile and write the result to outputdir.
Keyword arguments:
name: name of the output file, excluding.jl. Defaults to the filename ofinputfile.preprocess,postprocess: custom pre- and post-processing functions, see the Custom pre- and post-processing section of the manual. Defaults toidentity.