What is Quantum Pro?
Quantum Pro is an interpreted programming language made in Xenon that combines the fundamental aspects of text based programming languages with features that exist in Xenon.
What’s NEW in version 2.0b?
increased performance. (1.7x faster than the latest version)
functions are now recursive.
repeat until loop.
2D list, matrices, and faster array lookup time
‘delete’ variable: removes a variable from memory.
multi-layered loops: loops in loops are now supported.
color display: keywords are now highlighted. (optional)
import: most inbuilt functions are now required to be imported, allowing more function names to be used.
break & void: the ability to stop the current loop and function respectively.
names such as “b3” are now no longer displayed as number values.
function parameters no longer have unexpected behaviors.
removed ‘stop this’ & ‘stop all’
removed uppercase support, enter-key now insert a new column.
merged int and doubles into num type.
Syntax
names must contain legal characters (0-9, a-z, and underline), no spaces, and no numbers as first letters.
all commands are separated by lines, semi-colons, or braces. Use semicolon “;” to break between two individual commands in a single line. semicolons are required to be added before closing braces if written in the same line!
don’t call functions inside function parameters, write it as a separate line.
Use hashtag # to write a comment.
all variables are global scope.
Variables
Here are some of the supported variable types in Quantum Pro. All assigned variables are global scope, no scoping rules apply.
Num: any number values.
String: word values, quoted in single or double quotation marks.
Boolean: true/false.
create a new variable or modify the existing variable by typing in the following syntax below, variable names may not contain blanks and must contain valid characters (0-9, a-z, and underline)
set <variable name> to <value>
use this command shown below “change <variable name> by <variable value>” to add the new number value to the original variable.
change <variable name> by <value>
this line of command removes the variable from memory.
delete <variable name>
Arraylist
also known as list or arrays; (implementation inspired by the java library) stores a sequence of dynamic typed data into a single variable, please follow the following syntax format to declare an array.
set numlist to [1,2,3,4,5]
set matrices to [[“a”, “b”, “c”], [“d”, “e”, “f”], [“g”, “h”, “i”]]
Operators
a + b #addition
a - b #subtraction
a * b #multiplication
a / b #division
a % b #modulus
a ^ b #exponent
a == b #equal to
a != b #not equal to
a > b #larger than
a < b #smaller than
a >= b #larger or equal than
a <= b #smaller or equal than
a && b #a and b must be true
a || b #either a or b is true
Function
Inbuilt functions
These methods are predefined and can mostly be assigned to a variable. depending on the function, some in-built functions don’t return values, therefore must be written independently.
join(<string1>, <input2>)
letter(<num1>, <string2>)
length(<input>)
contain(<input1>, <input2>)
username()
input(<string>)
not(<boolean>)
parse.num(<string>)
parse.str(<num>)
parse.type(<input>) #returns a string of the variable type
here are some of the inbuilt functions used to modify arraylists. (arrays passed through function parameters need to be reassigned into a new variable in order to modify the referenced array)
#these don’t return values:
<variable name>.add(<element>)
<variable name>.delete(<index>)
<variable name>.set(<index>, <element>)
<variable name>.insert(<index>, <element>)
<variable name>.extend(<arraylist variable>) #adding all the elements from the referenced array to the current array
#these do return values:
<variable name>.get(<index>)
<variable name>.item(<element>)
Define function
define a function by writing “define <function name>”, then proceed to write input(s) separated by comma(s) or write an empty parenthesis if you do not wish to have any input; followed by an open braces. user defined functions do not return values.
define multiply(input1, input2) {
set output to input1 * input2
print(output)
}
To call your function, if it was an inbuilt or imported function, assign the function to a variable, else, write it in an independent line.
multiply(4, -6) #calling a defined function
set x to math.abs(-3.14) #only inbuilt functions can be assigned to variables
Import
As of v2.0.0, all addon functions are moved to import to avoid function name conflict. Use import function to add more inbuilt functions to existing functionality. If a function returns no value, write it independently.
import time #import the entire library of functions related to time
import time.sec #import specific function from the library
set x to math.abs(-20.5689)
#all the portable function/library names
math
math.pi()
math.abs(<num>)
math.floor(<num>)
math.ceil(<num>)
math.sqrt(<num>)
math.sin(<num>)
math.cos(<num>)
math.tan(<num>)
math.asin(<num>)
math.acos(<num>)
math.atan(<num>)
math.ln(<num>)
math.log(<num>)
math.e(<num>)
math.abs(<num>)
math.round(<num>)
math.random(<num1>, <num2>)
time
time.year()
time.month()
time.date()
time.dow() #day of week
time.hr()
time.min()
time.sec()
time.dstt() #day since 2000
time.wait(<num>)
Control Flow
if (boolean) {
write your conditional statement with the following syntax, “if (<boolean1>) {”, the conditions inside can be variables.
if ((103 != 90) && (“hello” != 2)) {
set retval to 500
}
set x to false
if (not(x)) {
set retval to x
}
else if (boolean) {
the conditional header will be evaluated if the previous conditionals were evaluated false. write else if statement with the following syntax,:
if (x == “+”) {
set ans to 1
} else if (x == “/”) {
set ans to 4; }
else {
the following code block will be executed if the previous conditionals were false. the header will execute if the previous conditionals were evaluated false. write the else statement with the following syntax, “else {”.
if (3.0 == 4.5) {
set ans to 1
} else {
set ans to 4
}
repeat (num) {
write the repeat loop to repeat number of times to execute code block within the two braces range.
set x to 0
repeat(1000) {
change x by 1
}
repeat until (boolean) {
write the repeat until loop to repeat executing the code block within the two braces range until the loop condition is true.
set x to 8
repeat until (x >= 50) {
change x by 3
}
break
break out of the most inner layer loop.
set i to 0
repeat(97) {
if (i > 65) {
break;
}
change i by 1
}
void
end/break the current stack (function call). similar to the concept of “return” statement but with no return value.
define return_until(a) {
if (a < 35) {
return_until(a+1)
}
else {
void
}}
This command allows you to display the output a new line to the console. Write your own print statement with the syntax of the following example.
set x to “hello Xenon!”
print(x)
Common Q&A:
I typed ____, it keeps showing other letters!
Try typing the wrong letter it displayed to you, press the left arrow key to backspace it, then type the correct letter. Although the best solution would be to export it, go to Turbowarp to import the code, then work from there instead to avoid typing bugs.
How do I share, save, or report a bug?
Go to settings in the Quantum Pro project, press the “Export code” button and copy the code shown in the list. Then, paste it down below in the discussion board.