Hello World

Hello world program

Program setup

Similar to typescript, a Type-C program requires a module.json that contain metadata about the project

Program Structure

Here's a breakdown of what's happening in this minimal Type-C program:

  • Importing Libraries: The first line import std.io.println tells the compiler to include the println function from the std.io library, which handles standard input and output operations.
  • Main Function: In Type-C, the program's entry point is the main function. The args: string[] parameter allows for command-line arguments to be passed into the program, and the -> u32 indicates that the function returns an unsigned 32-bit integer.
  • Printing to the Console: Inside the main function, we call print("Hello, world!"). This invokes the println function to display the string "Hello, world!" on the standard output (stdout).
  • Exit Status: The return 0 statement signifies successful program termination. A return value of 0 typically indicates that the program has executed without any errors.

What you might have noticed at first sight, is that Type-C doesn't requires a semicolon at the end of every instruction, unlike to most C-family programming languages but just like typescript (Optional).


Kudos! Keep reading!