Dynamically typed language called Stitch (filetype .st or .stitch) based of Ruby, Python and JavaScript. Spaces are new lines (except for stringed spaces and other cases) which allows for minification. Comments are double quotes and multilined, while strings are single quotes.
To print hello:
print('hello')
To get name and print hello $name
name=input('name: ')
print('hello (name)') "to actually print ( and ) do \( and \) respectively"
To differentiate from executing and defining functions you need to specify wether the function is public (accessible by anything) or private (only accessible by the same namespace). It is done by specifying using the syntax public#functionName()
and private#functionName()
. Default is public.
To make a function which prints hello
public#sayHello()
print('hello')
end
To make a function which prints hello $name
public#sayHelloTo(name)
print('hello (name)')
end
To make a class with the property's width and height
ClassName
public#init() "init function"
this.width=10
this.height=10
end
end
Variable=ClassName()
To extend the class Animal with the name Dog
Animal
public#init()
this.name='myAnimalName'
end
end
Animal.Dog
public#action()
print('Bark!')
end
end
"Dog can do the Animal init() function and action() function. It is called via Dog"
pet=Dog()
Most functions like ==
for equals and !
for not like in JavaScript apply.
To import is a bit like in Python import('filename')
, except it runs the code as the source, so A class in file.stitch would not be accessible from file.Class, it would just be Class.