mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Add detail to negation docs
I felt the negation docs didn't cover checking if a value was *not* another value and didn't point out that `not` can't be combined with other operators. [ci skip]
This commit is contained in:
parent
3b06385b7d
commit
25c84709f1
@ -178,7 +178,7 @@ Conditionals can also provide the `else` case.
|
|||||||
|
|
||||||
### Negation
|
### Negation
|
||||||
|
|
||||||
The inverse of `<% if %>` is `<% if not %>`.
|
You can check if a variable is false with `<% if not %>`.
|
||||||
|
|
||||||
```ss
|
```ss
|
||||||
<% if not $DinnerInOven %>
|
<% if not $DinnerInOven %>
|
||||||
@ -186,6 +186,17 @@ The inverse of `<% if %>` is `<% if not %>`.
|
|||||||
<% end_if %>
|
<% end_if %>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that you cannot combine this with other operators such as `==`.
|
||||||
|
|
||||||
|
|
||||||
|
For more nuanced check you can use the `!` operator.
|
||||||
|
|
||||||
|
```ss
|
||||||
|
<% if $MyDinner != "quiche" %>
|
||||||
|
Lets go out
|
||||||
|
<% end_if %>
|
||||||
|
```
|
||||||
|
|
||||||
### Boolean Logic
|
### Boolean Logic
|
||||||
|
|
||||||
Multiple checks can be done using `||`, `or`, `&&` or `and`.
|
Multiple checks can be done using `||`, `or`, `&&` or `and`.
|
||||||
|
Loading…
Reference in New Issue
Block a user