Empty Script
block foo(number n):
if n < 5 then
return "n is less than 5"
else
"n is greater than 5"
return 100 + foo(100)
Hello World
return "Hello world"
Greeting to
/* Variables are generally declared with a type such as boolean, number, string. If the type is omitted, the variable will accept any value without converting. */
string greeting: "Hello"
string to: "world"
return greeting & " " & to & to & "to"
// the string concatenation operator is &, but the + operator (generally reserved for math) also works in a pinch
const hoisting
/* any variables declared with the const keyword will be ‘hoisted’, ie, declared and available for use immediately upon block initialization. However, if the value of the const depends on a non-const value ... it may or may not bork*/
number six: plusOne(6) - 1
return six+1
const plusOne(number param1: 0+0):
param1++
local number result
if param1 then result: param1 else result: -1
return result
New Person
const block newPerson(string name, number age):
if name == "" then name: "no name"
if age < 0 then age: 0 - age
var string foo
var block Ryan:
prop string name: "Ryan"
prop number age: 30
foo: "hello world"
var out: foo
if !out? then
return "🙁"
else return 'output is:\n' & out
// return if !foo.bar? then "no foobar" else if foo.bar? then "foo.bar"
Array Block
block sumNums:
number one: 1
number two: 1
number ["five"]: 5 // this is the same as five (without square brackets and quotes)
var [3]: 100
number [4]: (0-1)*1/2
// skipping 5 and 6
number [7]: 0
string number result: 1
for number i in range(0,8)
if !(sumNums[i] == null) then
result +: sumNums[i]
return result
<blank>
block newPerson(string name, number age):
"lines of code"
var Ryan: newPerson("Ryan", 30)
var Veron: newPerson(age:30, name:"Veron")
return Veron.name
<blank>
block newPerson(string name, number age):
if name = "" || !name then name: "no name"
block greet():
return "Hello " + name
var ryan: newPerson("Ryan", 30)
return $ryan.greet
Array Literal
var myList: [1,2,3]
number sum: 0
for i in myList
sum +: i
return sum
another loop
number num: 10
for n in range(1,10)
num +: n
return num
the mapper
block sumNums:
number one: 1
number two: 2
number three: 5
var four: 10
number five: -1/2
number sum: 0
string result: "First call: "
for number i in range(0, sumNums.length)
sum +: sumNums[i]
result &: sum & "\nSecond call: "
block timesTen(number x):
return x*10
sumNums.map(timesTen)
sum: i: 0
for i in range(0,sumNums.length)
sum +: sumNums[i]
return result & sum
<blank>
block plusOne(number x):
return x + 1
return "Hello " & plusOne(9)
<blank>
string cor: `Greeting
1 Paul, an apostle of Christ Jesus through the will of God, and Timothy our brother, to the church of God that is in Corinth, together with all the saints who are in all Achaia. 2 Grace to you and peace from God our Father and the Lord Jesus Christ.
Thanksgiving for God’s Compassion and Comfort
3 Blessed is the God and Father of our Lord Jesus Christ, the Father of mercies and God of all comfort, 4 who comforts us in all our affliction, so that we may be able to comfort those who are in all affliction with the comfort with which we ourselves are comforted by God. 5 For just as the sufferings of Christ overflow to us, thus through Christ our comfort overflows also. 6 But if we are afflicted, it is for your comfort and salvation; if we are comforted, it is for your comfort that is at work in the patient endurance of the same sufferings that we also suffer. 7 And our hope for you is firm, because we[a] know that as you are sharers in the sufferings, so also you will be sharers in the comfort.
8 For we do not want you to be ignorant, brothers, concerning our affliction that happened in the province of Asia,[b] that we were burdened to an extraordinary degree, beyond our strength, so that we were in despair even of living. 9 But we ourselves had the sentence of death in ourselves, so that we would not be putting confidence in ourselves, but in God who raises the dead, 10 who delivered us from so great a risk of death, and will deliver us, in whom we have put our hope that he will also deliver us again, 11 while[c] you also join in helping on our behalf[d] by prayer, so that thanks may be given on our behalf[e] by many persons for this gracious gift given to us through the help of many.
Paul’s Clear Conscience
12 For our reason for boasting is this: the testimony of our conscience that we conducted ourselves in the world, and especially toward you, in holiness[f] and purity of motive from God, not[g] in merely human wisdom, but by the grace of God. 13 For we are not writing anything else to you except what you can read or also understand. But I hope that you will understand completely[h], 14 just as you have also understood us in part, that we are your reason for boasting, just as you are also ours in the day of our Lord Jesus.
Paul Delays His Visit to Corinth
15 And with this confidence, I was wanting to come to you previously, in order that you may have a second proof of my goodwill, 16 and through you to go to Macedonia, and to come to you again from Macedonia, and to be sent on my way by you to Judea. 17 Therefore, when I[i] was wanting to do this, perhaps then was I making use of vacillation? Or was I deciding what I was deciding according to the flesh, in order that with me my “yes” may be “yes” and my “no” may be “no” at the same time?[j] 18 But God is faithful, so that our word to you is not “yes” and “no.” 19 For the Son of God, Jesus Christ, the one who was proclaimed among you by us, by me and Silvanus and Timothy, did not become “yes” and “no,” but has become “yes” in him. 20 For as many as are the promises of God, in him they are “yes”; therefore also through him is the “amen” to the glory of God through us. 21 Now the one who establishes us together with you in Christ and who anoints us is God, 22 who also sealed us and gave the down payment of the Spirit in our hearts.
23 But I call upon God as witness against my life, that in order to[k] spare you, I did not come again to Corinth. 24 Not that we lord it over your faith, but we are fellow workers for your joy, because by faith you stand firm.`
string word: "submit"
var corList: cor.split(" ")
return cor