mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #8310 from blueo/patch-1
Add detail to negation docs
This commit is contained in:
commit
7daea920f2
@ -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