Syntax

Here a basic run down of UCodeLang Syntax for People who already know how a programming language.

UCode uses Sugnificant Whitespace like python.

The syntax for declaring a function in UCode is as follows:

|function_name[parameter_list];//not being explicit with the return
|function_name[parameter_list] -> void;

For example, the following code declares a function named add that takes two integer parameters and returns an integer:

|add[int x, int y] -> int;

Variables are declared with a type and a name. For example, the following code declares an integer variable named x:

int x;

Member functions are just functions with a this parameter

use ULang;

$MyClass:
  |SayHello[this&]:
    Fmt::Print("Hello, World!");

|main[]:
  var object = MyClass();
  object.SayHello();

To access a static variable or function in UCode, you can use the class name and the scope resolution operator (::).

//no use of the ULang namespace;
|main[]:
  ULang::Fmt::Print("Hello");

functions can be expressed in different ways.

|add[int x, int y] => x + y;
    
|add2[int x, int y] -> int:
  ret x + y;

|add3[int x, int y]:
  ret x + y;

enums are is as follows:

$Color enum:
  Red,
  Green,
  Blue,

namespaces are is as follows:

MyNamespaces: 
  static int MyStaticValue = 10;
  thread int MythreadLocalValue =10; 
  int Value = 10;//also my threadLocalValue 

using namespaces is as follows:

use MyNamespaces;

alias is as follows:

$i64 = int64;
$u32 = uint32;

inheritance look like this

$Worker trait;//no members

$FasterWorker[Worker];//no members

Object protections look like this

$Worker;

$FasterWorker[Worker]:
  public:
    int Hp = 10;
  private:
    int Money = 10;
    int Happiness = 10;

Standard Library Compiler alias

int? MaybeAnInt;//an optional int
int[] Ints;//an Vector<int>

int[5] MoreInts;//an Array<int,5> //an Array<int,(somevarable)>
int[(somevarable)] MoreInts; //an Array<int,(somevarable)>  Map short hand takes precedent over array in this case so you need parentheses. 
int[String] StringToIntMap;//an Map<String,int>
int[sometype] SomeTypeToIntMap;//an Map<sometype,int>
int[:] SpanOfInts;//an Span<int>
int^ UniqueInt;//an Unique_ptr<int>
int$ SharedInt;//an Shared_ptr<int>
int[^] UniqueIntsArray;//an Unique_Array<int>
int[$] SharedIntsArray;//an Shared_Array<int>

immutability

imut int ConstInt = 5;
imut ConstInt2 = 4;// or like this.    
$MyClass:
  |SayHello[umut this&]:
    Fmt::Print("Hello, World!");

references

|main[]:  
  int x = 10;
  int& r = x;

|Update_NumToChange[int& V]:
  V = 10;

Thats the basics heres. Some links Explore More: