diff options
author | Bruce Richardson <bruce.richardson@intel.com> | 2018-09-20 15:17:40 +0100 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-09-20 08:13:08 -0700 |
commit | 62d92e3a19e2e6b599a8499dee24f857b46123b4 (patch) | |
tree | 0f26f4b81bce8d41c1734b71252e1ca74b73bc33 | |
parent | f657658473bfc0b342cf532bd7ac6788f2c1e9f2 (diff) | |
download | meson-62d92e3a19e2e6b599a8499dee24f857b46123b4.zip meson-62d92e3a19e2e6b599a8499dee24f857b46123b4.tar.gz meson-62d92e3a19e2e6b599a8499dee24f857b46123b4.tar.bz2 |
syntax guide: move logical ops section beside if statement [skip ci]
The "if" statement only covers a small set of the possible ways in
which conditionals can be written, since it leaves the use of
"and", "or" and "not" to the "Logical Operations" section. However,
this is likely to be of interest to those reading about "if" statments,
so move the "logical operations" section up to immediately follow it.
This change also puts in the use of the "!=" operator in the example
to widen the variety of combinations shown.
-rw-r--r-- | docs/markdown/Syntax.md | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/docs/markdown/Syntax.md b/docs/markdown/Syntax.md index efb12e4..ff4c142 100644 --- a/docs/markdown/Syntax.md +++ b/docs/markdown/Syntax.md @@ -354,11 +354,34 @@ else endif opt = get_option('someoption') -if opt == 'foo' +if opt != 'foo' do_something() endif ``` +Logical operations +-- + +Meson has the standard range of logical operations which can be used in +`if` statements. + +```meson +if a and b + # do something +endif +if c or d + # do something +endif +if not e + # do something +endif +if not (f or g) + # do something +endif +``` + +Logical operations work only on boolean values. + ## Foreach statements To do an operation on all elements of an iterable, use the `foreach` @@ -409,28 +432,6 @@ foreach name, sources : components endforeach ``` -Logical operations --- - -Meson has the standard range of logical operations. - -```meson -if a and b - # do something -endif -if c or d - # do something -endif -if not e - # do something -endif -if not (f or g) - # do something -endif -``` - -Logical operations work only on boolean values. - Comments -- |