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.
pull/4230/head
Bruce Richardson 6 years ago committed by Nirbheek Chauhan
parent f657658473
commit 62d92e3a19
  1. 47
      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
--

Loading…
Cancel
Save