From Clomosy Docs

No edit summary
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
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.<br>
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.<br>
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.<br>


Line 11: Line 9:
Every Clomosy program has an execution section in a specific order. The following format shows the basic syntax of a Clomosy program:<br>
Every Clomosy program has an execution section in a specific order. The following format shows the basic syntax of a Clomosy program:<br>


<div class="row">
<div class="col-lg-6">
<div class="card">
<p> <b>TRObject Syntax</b></p>
<pre>
<pre>
const //global constant declaration block
const //global constant declaration block
Line 36: Line 29:
} //the end of main program block  
} //the end of main program block  
</pre>
</pre>
</div>
</div>
<div class="col-lg-6">
<div class="card">
<p> <b>Base Syntax</b></p>
<pre>
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
</pre>
</div>
</div>
</div>
</div>
<br>
<br>


Line 72: Line 36:
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!"


<b>TRObject Syntax </b>
<pre>
<pre>
{
{
Line 79: Line 42:
</pre>
</pre>


<b>Base Syntax </b>
<pre>
begin
  ShowMessage('Hello World!');
end;
</pre>


This will produce following result<br>
This will produce following result<br>
Line 95: Line 52:


<div class="alert alert-primary" role="alert" data-bs-theme="light">
<div class="alert alert-primary" role="alert" data-bs-theme="light">
* The first line of the program is enclosed in { and } in TRObject syntax, and in begin and end statements in Base syntax; these form the main program block. In Clomosy, every block is enclosed by a start ({ or begin) statement and an end (} or end) statement.
* The first line of the program is enclosed by { and } expressions; these form the main program block.
* The start ({ or begin) statement of the main program block is where the program execution begins.
* In Clomosy, each block is surrounded by a start ( { ) expression and an end ( } ) expression. The main program block's start ( { ) expression marks where the program begins executing.
* The statement ShowMessage('Hello, World!'); uses the ShowMessage function available in Clomosy to display the message "Hello, World!" on the screen.
* The statement ShowMessage('Hello, World!'); displays the message "Hello, World!" on the screen using the ShowMessage function available in Clomosy.
* The last statement (} or end) ends your program.
* The final expression ( } ) ends your program.
</div>
</div>


Line 106: Line 63:
* Open the Clomosy developer editor (cms.clomosy.com) and add the code mentioned above.
* Open the Clomosy developer editor (cms.clomosy.com) and add the code mentioned above.
* Save the program by pressing Ctrl+S or clicking the 'Save' button.
* Save the program by pressing Ctrl+S or clicking the 'Save' button.
* Include the Clomosy Learn application by [[Clomosy_Installation | downloading]] and [[Users | signing in]].
* [[Clomosy_Installation | Download]] and [[Users | sign in]] to the Clomosy Learn application.
* After including the project, click on the project name.
* After including the project, click on the project name.
* 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.
Line 120: Line 77:
* Error Management
* Error Management


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


<b>TRObject Syntax</b>
<pre>
<pre>
{
{
Line 128: Line 84:
}
}
</pre>
</pre>
<b>Base Syntax</b>
{{#seo:|description=Learn about Program Structure in Clomosy! A guide to organizing and structuring your code for efficient mobile app development.}}
<pre>
begin
  ...
end;
</pre>

Latest revision as of 14:24, 23 December 2024

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:

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 


TRObject Hello World Example

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

{
  ShowMessage('Hello World!');
}


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 with curly braces ({...}) in TRObject syntax.

{
  ...
}