forked from gnolang/gno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Norman Meier <[email protected]>
- Loading branch information
Showing
6 changed files
with
120 additions
and
18 deletions.
There are no files selected for viewing
16 changes: 9 additions & 7 deletions
16
examples/gno.land/r/demo/bugs/slice_pop_push/slice_pop_push.gno
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 |
---|---|---|
@@ -1,19 +1,21 @@ | ||
package slice_pop_push | ||
|
||
import ( | ||
"strings" | ||
) | ||
|
||
var slice = []string{"undead-element"} | ||
|
||
func Pop() { | ||
func Pop() []string { | ||
slice = slice[:len(slice)-1] | ||
return slice | ||
} | ||
|
||
func Push() { | ||
func Push() []string { | ||
slice = append(slice, "new-element") | ||
return slice | ||
} | ||
|
||
func Render(path string) string { | ||
os := []string{"undead-element-2"} | ||
os = os[:len(os)-1] | ||
os = append(os, "new-element-2") | ||
|
||
return os[0] + slice[0] | ||
return strings.Join(slice, ",") | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.