Skip to content

Instantly share code, notes, and snippets.

@matisiekpl
Last active June 27, 2019 08:53
Show Gist options
  • Select an option

  • Save matisiekpl/91b7eb77cb2ae7943b703e368fc61c11 to your computer and use it in GitHub Desktop.

Select an option

Save matisiekpl/91b7eb77cb2ae7943b703e368fc61c11 to your computer and use it in GitHub Desktop.
{
"functions": [
{
"key": "math.add",
"name": "add",
"code": "out = a + b",
"dependencies": {
"@types/node": "^12.0.10"
},
"arguments": [
{
"name": "a",
"schema": {
"type": "int"
}
},
{
"name": "b",
"schema": {
"type": "int"
}
}
],
"results": [
{
"name": "out",
"schema": {
"type": "int"
}
}
]
},
{
"key": "print",
"name": "print",
"code": "console.log(message)",
"dependencies": {
"@types/node": "^12.0.10"
},
"arguments": [
{
"name": "message",
"schema": {
"type": "string"
}
}
]
},
{
"key": "if",
"name": "if",
"code": "if(expression) when_true(); else when_false();",
"dependencies": {
"@types/node": "^12.0.10"
},
"arguments": [
{
"name": "expression",
"schema": {
"type": "string"
}
},
{
"name": "when_true",
"schema": {
"type": "call"
}
},
{
"name": "when_false",
"schema": {
"type": "call"
}
}
]
}
],
"main": [
{
"function_key": "math.add",
"name": "add",
"arguments": [
{
"name": "a",
"value": 7
},
{
"name": "b",
"value": 5
}
],
"results": [
{
"name": "out",
"variable": "out"
}
]
},
{
"function_key": "if",
"name": "decide",
"arguments": [
{
"name": "expression",
"value": "out > 11"
},
{
"name": "when_true",
"value": {
"function_key": "print",
"name": "print success",
"arguments": [
{
"name": "message",
"value": "'It works! The result is equal to:' + out"
}
]
}
},
{
"name": "when_false",
"value": {
"function_key": "print",
"name": "print error",
"arguments": [
{
"name": "message",
"value": "'Oh, something is wrong'"
}
]
}
}
]
},
{
"function_key": "print",
"name": "print at the end",
"arguments": [
{
"name": "message",
"value": "out"
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment