Title here
Summary here
In AngelScript, variables are explicitly declared and used by the compiler to check type-correctness of function calls.
void main()
{
// 'string' declares a variable of type string
string a = "initial";
print(a);
// You can declare multiple variables at once
int b = 1, c = 2;
print(b + " " + c);
// AngelScript will infer the type of initialized variables
auto d = true;
print(d);
// Variables declared without a corresponding
// initialization are zero-valued. For example, the
// zero value for an int is 0.
int e;
print(e);
// AngelScript doesn't have a shorthand syntax for
// declaring and initializing variables like ':=' in some languages.
// We simply use the standard assignment operator '='
string f = "apple";
print(f);
}
To run this AngelScript code, you would typically embed it in a host application that provides the AngelScript runtime. The exact method of execution depends on your specific setup.
Here’s what the output would look like:
initial
1 2
true
0
apple
In AngelScript:
string a
or int b
.auto
keyword can be used for type inference.Remember that AngelScript is typically used as a scripting language within a larger application, so the exact method of running and building programs may vary depending on your specific environment and setup.