Values in AngelScript

Strings, integers, floats, booleans, etc. Here are a few basic examples.

void main() {
    // Strings, which can be added together with `+`.
    print("go" + "lang" + "\n");

    // Integers and floats.
    print("1+1 = " + (1 + 1) + "\n");
    print("7.0/3.0 = " + (7.0 / 3.0) + "\n");

    // Booleans, with boolean operators as you'd expect.
    print("" + (true && false) + "\n");
    print("" + (true || false) + "\n");
    print("" + (!true) + "\n");
}

To run the script, save the code in a file with an .as extension and use an appropriate AngelScript runtime or engine to execute it. For example:

$ angelscript values.as
golang
1+1 = 2
7.0/3.0 = 2.3333333333333335
false
true
false

Next example: Variables.

查看推荐产品

Comments powered by Disqus