. examples/types.jb
. An example demonstrating types in juicebox
.
. Copyright (C) 2024 Max Walters
.
. To the extent possible under law, the author(s) have dedicated all copyright
. and related and neighboring rights to this software to the public domain
. worldwide. This software is distributed without any warranty.
.
. You should have received a copy of the CC0 Public Domain Dedication along
. with this software. If not, see
. <http://creativecommons.org/publicdomain/zero/1.0/>.
using std; // import standard library
main { // main function
_string:string = "Hello, world!"; // creates a string variable with the string "Hello, world!"
_number:number = 1234; // creates a number variable with the number 1234
_array:string[] = [ "Hello, world!" ]; // creates a array variable with the string "Hello, world!"
_infer = "This mat or may not be a string"; // creates a variable with the strng "This may or may not be a string," inferring the type.
**("string: {_string}); // prints "string: Hello, world!"
**("number: {_number}"); // prints "number: 1234"
**("array: {_array.0}") // prints "array: Hello, world!"
0; // exits with code 0
}