Artsy declaration statements allow for three different types: “int”, “float”, and “string”.
Integers (”int”) are a basic number variable type. They only use whole numbers (-1, 0, 1, 2, 3, etc.). Here’s how to use them within your program.
# Example Declare Statement
# Use the keyword "int"
declare x as int;
# Example Prepare Statements
let x = 10 + 2 + 3;
let x = -30;
let x = x - 30;
# Finally, print it!
print x;
Floats (”float”) are another number variable type. They require the use of decimal points (e.g. 1.323). Here’s how to use them within your program.
# Example Declare Statement
# Use the keyword "float"
declare x as float;
# Example Prepare Statements
# Must contain a decimal symbol (example: 10.0)
let x = 30.39;
#/
Note: These are INVALID statements!!!
let x = 10; // Does not use decimal place
let x = 10.38 + 40; // Cannot add an integer to a float variable
#/
# Finally, print it!
print x;
Strings (”string”) are a text-based variable type. They allow any number of letters (or characters) to be combined together within prepare and print statements. Here’s how to use them within your program.
# Example Declare Statement
# Use the keyword "string"
declare x as string;
# Example Prepare Statements
# Must contain text between two " symbols
let x = "Hi there!";
# Finally, print it!
print x;
addline;
# Shortcut method!!!
print "Look ma, one line of code!";