From 6d8dfe57c0088534d7f87916f6846e7ed504dba9 Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 23 Jan 2018 14:56:30 +0100 Subject: [PATCH] Doc - added documentation for ArangoShell `print` function (#4397) --- .../Manual/Administration/Arangosh/Output.md | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Documentation/Books/Manual/Administration/Arangosh/Output.md b/Documentation/Books/Manual/Administration/Arangosh/Output.md index a31206e18c..73f36864df 100644 --- a/Documentation/Books/Manual/Administration/Arangosh/Output.md +++ b/Documentation/Books/Manual/Administration/Arangosh/Output.md @@ -1,6 +1,33 @@ ArangoDB Shell Output ===================== +The ArangoDB shell will print the output of the last evaluated expression +by default: + + @startDocuBlockInline lastExpressionResult + @EXAMPLE_ARANGOSH_OUTPUT{lastExpressionResult} + 42 * 23 + @END_EXAMPLE_ARANGOSH_OUTPUT + @endDocuBlock lastExpressionResult + +In order to prevent printing the result of the last evaluated expression, +the expression result can be captured in a variable, e.g. + + @startDocuBlockInline lastExpressionResultCaptured + @EXAMPLE_ARANGOSH_OUTPUT{lastExpressionResultCaptured} + var calculationResult = 42 * 23 + @END_EXAMPLE_ARANGOSH_OUTPUT + @endDocuBlock lastExpressionResultCaptured + +There is also the `print` function to explicitly print out values in the +ArangoDB shell: + + @startDocuBlockInline printFunction + @EXAMPLE_ARANGOSH_OUTPUT{printFunction} + print({ a: "123", b: [1,2,3], c: "test" }); + @END_EXAMPLE_ARANGOSH_OUTPUT + @endDocuBlock printFunction + By default, the ArangoDB shell uses a pretty printer when JSON documents are printed. This ensures documents are printed in a human-readable way: @@ -14,7 +41,7 @@ printed. This ensures documents are printed in a human-readable way: @endDocuBlock usingToArray While the pretty-printer produces nice looking results, it will need a lot of -screen space for each document. Sometimes, a more dense output might be better. +screen space for each document. Sometimes a more dense output might be better. In this case, the pretty printer can be turned off using the command *stop_pretty_print()*.