From 182510cadb7f5c1b080380892d04701f66d32660 Mon Sep 17 00:00:00 2001 From: Stephan Hilb Date: Sun, 2 Sep 2018 13:27:46 +0200 Subject: [PATCH] doc/faq: move question to correct section (#28997) (cherry picked from commit f77c36bc7511fd384388561c69c0e79546e2aeae) --- doc/src/manual/faq.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/doc/src/manual/faq.md b/doc/src/manual/faq.md index 192aa287689fd..63011925ad498 100644 --- a/doc/src/manual/faq.md +++ b/doc/src/manual/faq.md @@ -41,6 +41,12 @@ obj3 = MyModule.someotherfunction(obj2, c) ... ``` +### How do I check if the current file is being run as the main script? + +When a file is run as the main script using `julia file.jl` one might want to activate extra +functionality like command line argument handling. A way to determine that a file is run in +this fashion is to check if `abspath(PROGRAM_FILE) == @__FILE__` is `true`. + ## Functions ### I passed an argument `x` to a function, modified it inside that function, but on the outside, the variable `x` is still unchanged. Why? @@ -645,13 +651,6 @@ as nothing but rather a tuple of zero values. The empty (or "bottom") type, written as `Union{}` (an empty union type), is a type with no values and no subtypes (except itself). You will generally not need to use this type. - -### How do I check if the current file is being run as the main script? - -When a file is run as the main script using `julia file.jl` one might want to activate extra -functionality like command line argument handling. A way to determine that a file is run in -this fashion is to check if `abspath(PROGRAM_FILE) == @__FILE__` is `true`. - ## Memory ### Why does `x += y` allocate memory when `x` and `y` are arrays?