diff --git a/site/constructs.pug b/site/constructs.pug index 01c1e71..41cf1f9 100644 --- a/site/constructs.pug +++ b/site/constructs.pug @@ -283,6 +283,112 @@ html(lang="en") | if(should_print) | render "Maybe had a true value." | else render "Maybe had a false value."; + br + + b(class="pb-2") Function Expression + p Function expressions define a function with optional parameters and a body. + + div(class="bg-primary w-100 mt-2") + p(class="text-white m-0 ms-2") example_14.utx + code(class="text-dark") + pre(class="border border-primary p-2") + | # Function example for printing a greeting message. + | + | greet = func(name) { + | render "Hello, " + name + "!\r\n"; + | }; + | + | greet("world"); + br + + b(class="pb-2") Array Expressions + p Array expressions create an array of values and/or elements. An array might contain combinations of number, string, function, nil, boolean values, or even another array. + + div(class="bg-primary w-100 mt-2") + p(class="text-white m-0 ms-2") example_15.utx + code(class="text-dark") + pre(class="border border-primary p-2") + | # Simple array example. + | + | array = ["Hello", "Kamusta", "Konnichiwa"]; + | render array[1] + "\r\n"; + + div(class="bg-primary w-100 mt-2") + p(class="text-white m-0 ms-2") example_16.utx + code(class="text-dark") + pre(class="border border-primary p-2") + | # Multidimensional array example. + | + | array = [[0, 1, 2], [3, 4, 5], [6, 7, 8]]; + | render array; + | render "\r\n"; + | + | array[1][1] = "Four"; + | render array; + | render "\r\n"; + br + + b(class="pb-2") Logical and Bitwise Expressions + p These expressions perform logical and bitwise operations. While the logical operators (|| and &t&) returns boolean values, the bitwise operators (| and &) returns number values. + + div(class="bg-primary w-100 mt-2") + p(class="text-white m-0 ms-2") example_17.utx + code(class="text-dark") + pre(class="border border-primary p-2") + | # Logical and bitwise operation examples. + | + | render (true || false) + "\r\n"; # Logical or + | render (true && false) + "\r\n"; # Logical and + | render (8 | 9) + "\r\n"; # Bitwise or + | render (8 & 9) + "\r\n"; # Bitwise and + | render (8 ^ 9) + "\r\n"; # Bitwise xor + br + + b(class="pb-2") Equality and Comparison Expressions + p These expressions compare expressions and returns boolean values. + + div(class="bg-primary w-100 mt-2") + p(class="text-white m-0 ms-2") example_18.utx + code(class="text-dark") + pre(class="border border-primary p-2") + | # Comparison operator examples. + | + | render (8 == 9) + "\r\n"; # Equals + | render (8 != 9) + "\r\n"; # Not equals + | render (8 < 9) + "\r\n"; # Less than equals + | render (8 > 9) + "\r\n"; # Greater than equals + | render (8 <= 9) + "\r\n"; # Less than equals + | render (8 >= 9) + "\r\n"; # Greater than equals + br + + b(class="pb-2") Shift Expressions + p These expressions perform bitwise shift operations. + + div(class="bg-primary w-100 mt-2") + p(class="text-white m-0 ms-2") example_19.utx + code(class="text-dark") + pre(class="border border-primary p-2") + | # Shift operator examples. + | + | render (8 << 9) + "\r\n"; # Left shift expression + | render (8 >> 9) + "\r\n"; # Right shift expression + br + + b(class="pb-2") Term and Factor Expressions + p These expressions perform basic arithmetic operations. + + div(class="bg-primary w-100 mt-2") + p(class="text-white m-0 ms-2") example_20.utx + code(class="text-dark") + pre(class="border border-primary p-2") + | # Term and factor operator examples. + | + | render (8 + 9) + "\r\n"; # Add + | render (8 - 9) + "\r\n"; # Subtract + | render (8 / 9) + "\r\n"; # Divide + | render (8 * 9) + "\r\n"; # Multiply + | render (8 % 9) + "\r\n"; # Reminder/Modulus + br div(class="col-lg-2")