๐ฆ HSX Variables
Learn how to declare and use variables in HSX.
Variables are declared using * name = value * syntax:
{`// Basic variable declaration HSX: * name = "Alice" * HSX: * age = 25.0 * HSX: * score = 95.5 * // Variable naming rules HSX: * myVariable = "valid" * HSX: * my_variable = "valid" * HSX: * myVariable123 = "valid" * // HSX: * 123invalid = "invalid" * // Can't start with number // HSX: * my-variable = "invalid" * // No hyphens // Case sensitive HSX: * Name = "Alice" * HSX: * name = "Bob" * // Different variable`} ๐ค String Variables {`// String assignment HSX: * name = "Alice" * HSX: * greeting = "Hello, " + name + "!" * HSX: * empty = "" * // Using strings in frontend HSX: +T_X_T+ ""Hello, "" + name HSX: +H_1+ ""Welcome "" + name // Strings in backend HSX: " "`} ๐ข Number Variables {`// Number assignment (must have decimal) HSX: * count = 42.0 * HSX: * price = 19.99 * HSX: * total = (count * price) * // Number operations HSX: * x = 10.0 * HSX: * y = 5.0 * HSX: * sum = (x + y) * HSX: * diff = (x - y) * HSX: * product = (x * y) * HSX: * quotient = (x / y) *`} ๐ List Variables {`// List declaration (numbers only) HSX: * numbers = [1.0, 2.0, 3.0, 4.0, 5.0] * HSX: * scores = [95.5, 87.0, 92.5] * // Accessing list elements HSX: * first = numbers[0] * // 1.0 HSX: * second = numbers[1] * // 2.0 // Using lists in loops HSX: @WHL@ * numbers = 5.0 * HSX: +T_X_T+ ""Item: "" + numbers[0] HSX: @WHL@ * numbers = 5.0 *`} โ ๏ธ Lists can only contain numbers in the current version.