-
-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
54 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
title: push | ||
--- | ||
|
||
{% since %}v10.8.0{% endsince %} | ||
|
||
Push an element into array. It's NON-DESTRUCTIVE, i.e. it does not mutate the array, but rather make a copy and mutate that. | ||
|
||
Input | ||
```liquid | ||
{% assign fruits = "apples, oranges" | split: ", " %} | ||
{% assign everything = fruits | push: "peaches" %} | ||
{% for item in everything %} | ||
- {{ item }} | ||
{% endfor %} | ||
``` | ||
|
||
Output | ||
```text | ||
- apples | ||
- oranges | ||
- peaches | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
title: push | ||
--- | ||
|
||
{% since %}v10.8.0{% endsince %} | ||
|
||
在数组中添加一个元素。注意该操作不会改变原数组,而是在一份拷贝上操作。 | ||
|
||
输入 | ||
```liquid | ||
{% assign fruits = "apples, oranges" | split: ", " %} | ||
{% assign everything = fruits | push: "peaches" %} | ||
{% for item in everything %} | ||
- {{ item }} | ||
{% endfor %} | ||
``` | ||
|
||
输出 | ||
```text | ||
- apples | ||
- oranges | ||
- peaches | ||
``` |
This file was deleted.
Oops, something went wrong.