Last active
December 12, 2015 05:28
-
-
Save piuccio/4721822 to your computer and use it in GitHub Desktop.
hashspace Foreach loop and json interaction
This file contains hidden or 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
// The model is accessible with the name `vscope` | |
// | |
// `json` has also methods to handle arrays | |
// - push | |
// - splice | |
// - shift | |
json.push(vscope.things, "Mangos"); | |
log(); | |
hsp.refresh(); |
This file contains hidden or 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
# template main(things) | |
Remember to buy: | |
# foreach oneThing in things | |
<br/> | |
# if oneThing_isfirst | |
First of all | |
# else | |
# if oneThing_islast | |
and last | |
# else | |
then | |
# /if | |
# /if | |
<strong>{oneThing}</strong> | |
# /foreach | |
# /template | |
display(main, [["Apples", "Pears", "Bananas"]]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment