From Clomosy Docs

No edit summary
No edit summary
Line 66: Line 66:
</div>
</div>
</div>
</div>
<br>


<h2> TRObject Hello World Example </h2>
<h4><b> TRObject Hello World Example </b></h4>


Following is a simple trobject code that would print the words "Hello, World!"
Following is a simple trobject code that would print the words "Hello, World!"
Line 109: Line 110:
* You will see "Hello World" displayed on the screen, and the program will wait until you press any key.
* You will see "Hello World" displayed on the screen, and the program will wait until you press any key.
</div>
</div>
<h2> Block Structure </h2>
In the TRObject programming language, block structures are used in various places to organize the logic of the code, manage control flow, and limit specific operations. Here are the common usage areas of block structures in TRObject:<br>
* Main Block
* Procedures and Functions
* Conditional Statements
* Loops
* Error Management
A block structure is defined in TRObject syntax with curly braces ({...}) and in Base syntax with begin and end blocks.<br><br>
<b>TRObject Syntax</b>
<pre>
{
  ...
}
</pre>
<b>Base Syntax</b>
<pre>
begin
  ...
end;
</pre>

Revision as of 12:45, 2 October 2024

The Clomosy platform offers two different syntax structures to provide flexibility and functionality in programming: TRObject and Base. Both structures serve different use cases and bring distinct approaches to the programming process.

Below are the headings for different usage structures of syntax used in the Clomosy platform. How each syntax is utilized will be detailed under the respective topics.

  • Loops
  • Conditions
  • Operators
  • Error Handling
  • Procedure Usage

Every Clomosy program has an execution section in a specific order. The following format shows the basic syntax of a Clomosy program:


TRObject Syntax

const //global constant declaration block
var //global variable declaration block

function //function declarations, if any
  //local variables
{
...
}

void //procedure declarations, if any
  //local variables
{
...
}

{ //main program block starts
...
} //the end of main program block 

Base Syntax

const //global constant declaration block
var //global variable declaration block

function //function declarations, if any
  //local variables
begin
...
end;

procedure //procedure declarations, if any
  //local variables
begin
...
end;

begin //main program block starts
...
end; //the end of main program block 


TRObject Hello World Example

Following is a simple trobject code that would print the words "Hello, World!"

TRObject Syntax

{
  ShowMessage('Hello World!');
}

Base Syntax

begin
  ShowMessage('Hello World!');
end;

This will produce following result

Let us look various parts of the above program

Execute Clomosy Program

Block Structure

In the TRObject programming language, block structures are used in various places to organize the logic of the code, manage control flow, and limit specific operations. Here are the common usage areas of block structures in TRObject:

  • Main Block
  • Procedures and Functions
  • Conditional Statements
  • Loops
  • Error Management

A block structure is defined in TRObject syntax with curly braces ({...}) and in Base syntax with begin and end blocks.

TRObject Syntax

{
  ...
}

Base Syntax

begin
  ...
end;