Version 2.0.0+
Keylang should be very easy to learn!
var vari_name = dict("a" = random(67, 68), "b" = 2763)
func cool_func{
print("hi")
loop(3){
wait(1)
self 's scale *= random(vari_name)
}
}
cool_func()
# prints hi, then, repeating 3 times, waits 1 second before multiplying self's scale by a random value from the dictionary vari_name.
If yes, and you have little programming experience, then that shows how readable Keylang (and Python) is!
If no, and you have a lot of programming experience, then that's not good for Keylang
While assuming you don't know any programming
print("hi")
This is a function that PRINTS "hi". Where? To the stdout (standard output). Basically it prints "hi" somewhere the screen.
If you run a .py file with print("hi") in it, it will quickly open a terminal (the output area), print hi, then immediately close. You'll only see hi for a a few milliseconds, but it works
However, .kl files do NOT support this yet. It's an early release ok
Even this simple function has a lot of complexity in it. Why, thou may ponder whilst gandering at the general direction of the brackets and quotation marks, are those labyrinthine syntax decisions required?
Print is the first part. It is the (built in) function you're calling. When calling functions, they must have brackets after them to contain the argument.
Right now you would have:
print()
print(hi)
var hi = 5
# Defines the variable hi with a value of 5
print(hi)
# This will print 5 instead of hi
print("hi")
Some words you type... are a type (literally).
"STRING"
# Specifies that it is TEXT (string)
'STRING'
# Same thing for single quotation marks
5
# Specifies that it is a WHOLE NUMBER (integer)
5.0
# Specifies that it is a DECIMAL NUMBER (float)
True
# Specifies that it is a TRUE or FALSE (boolean)
array(5, 2763, "string")
# Can contain multiple values
print("STRING")
# Prints STRING
print(5)
# Prints 5
print(5.0)
# Prints 5.0
print(True)
# Prints True
print(array(5, 2763, "string"))
# Prints 5, 2763, "string"
var this_is_a_var = 5
# Creates a variable named this_is_a_var with the value of 5
var not = 5
# Errors, cannot assign value to any reserved keywords
var print = 5
# Works, but horrible idea, as the print() function would stop working
var this_is_a_var = "hi"
# Creates a variable named this_is_a_var with the value of "hi"
print(this_is_a_var)
# Prints hi
print(6 * 7)
# Prints 42
print("hi" + 'there')
# Prints hithere (no spaces)
var vari_name = 0
# Creates a variable named vari_name with the value of 0
vari_name += 5
# Adds 5 to vari_name, new value is 5
vari_name *= 5
# Multiplies vari_name by 5, new value is 25
vari_name /= 5
# Divides vari_name by 5, new value is 5
vari_name = 5
# It's reverse for this. == would mean "is equal to" and = would mean "WILL be equal to"
# Sets vari_name to 5, new value is... also 5
Now, looking back at the code from the start:
var vari_name = dict("a" = random(67, 68), "b" = 2763)
func cool_func{
print("hi")
loop(3){
wait(1)
self 's scale *= random(vari_name)
}
}
cool_func()
# prints hi, then, repeating 3 times, waits 1 second before multiplying self's scale by a random value from the dictionary vari_name.
Functions are different from Python in Keylang.
Functions are defined using the func keyword. Calling a function with the function's name will execute the code in the function.
func cool_func {
# creates a function called cool_func
print("hi")
}
cool_func()
# Calls the function named cool_func, therefore printing hi
func cool_func {
print("this is in the function")
var_name = "this only exists in the function"
}
print("this is out of the function")
cool_func
# WRONG
cool_func()
# RIGHT!!!
Now, looking back at the code from the start AGAIN:
var vari_name = dict("a" = random(67, 68), "b" = 2763)
func cool_func{
print("hi")
loop(3){
wait(1)
self 's scale *= random(vari_name)
}
}
cool_func()
# prints hi, then, repeating 3 times, waits 1 second before multiplying self's scale by a random value from the dictionary vari_name.
Looking back:
print(array(5, 2763, "string"))
# Prints 5, 2763, "string"
the_LIST_name = array(value1, value2, "you_can_add_as_much_as_you_want")
var var_name = array(5, 2763, "string"))
print(var_name[0])
# Prints the FIRST number in the list, which would be 5
print(var_name[1] + 5)
# Prints the SECOND number in the list PLUS 5, which would be 2768
print(var_name[2])
# Prints the THIRD number in the list, which would be "string"
var var_LIST = array(5, 2763)
var var_dict = dict("a" = 5, "b" = 2763)
# You don't need to create these variables, but you can use created variables
print(var_LIST[0])
# Prints the FIRST number in the list, which would be 5
print(var_dict["a"])
# Prints whatever "a" is assigned to in the dictionary, which would be 5
var vari_name = dict("a" = random(67, 68), "b" = 2763)
Now, looking back at the code from the start yet AGAIN:
var vari_name = dict("a" = random(67, 68), "b" = 2763)
func cool_func{
print("hi")
loop(3){
wait(1)
self 's scale *= random(vari_name)
}
}
cool_func()
# prints hi, then, repeating 3 times, waits 1 second before multiplying self's scale by a random value from the dictionary vari_name.
self 's scale *= random(vari_name)
The rest you'll need to know is on the main page, and on the Python website cause they're THAT similar