From Clomosy Docs

No edit summary
No edit summary
 
(4 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">
<br>
<div class="card">
 
<p> <b>Base Syntax</b></p>
<h4><b> TRObject Hello World Example </b></h4>
 
Following is a simple trobject code that would print the words "Hello, World!"
 
<pre>
<pre>
const //global constant declaration block
{
var //global variable declaration block
  ShowMessage('Hello World!');
}
</pre>


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


procedure //procedure declarations, if any
This will produce following result<br>
  //local variables
begin
...
end;


begin //main program block starts
<div class="alert alert-light" role="alert" data-bs-theme="light">
...
Hello World!
end; //the end of main program block
</pre>
</div>
</div>
</div>
Let us look various parts of the above program<br>
<div class="alert alert-primary" role="alert" data-bs-theme="light">
* The first line of the program is enclosed by { and } expressions; these form the main program block.
* 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!'); displays the message "Hello, World!" on the screen using the ShowMessage function available in Clomosy.
* The final expression ( } ) ends your program.
</div>
</div>
<b> Execute Clomosy Program </b>
<div class="alert alert-success" role="alert" data-bs-theme="light">
* 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.
* [[Clomosy_Installation | Download]] and [[Users | sign in]] to the Clomosy Learn application.
* 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.
</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>


<h2> Variable Declaration</h2>
* Main Block
* Procedures and Functions
* Conditional Statements
* Loops
* Error Management


In the Clomosy platform, variable declaration is an important step for storing and processing data during the execution of a program. Variables are defined to hold values of a specific data type and can be used in different parts of the program. When declaring a variable, the var keyword is used first. Under this keyword, multiple variables can be defined.<br>
A block structure is defined with curly braces ({...}) in TRObject syntax.<br><br>


Under the <b>var</b> keyword, the name of the variable to be declared is specified first, followed by the data type to be used (for example, integer, floating-point, or text). This allows values to be dynamically assigned during the program flow, enabling various operations to be performed on these values. Proper variable declarations enhance code readability and facilitate program maintenance.
<pre>
{
  ...
}
</pre>
{{#seo:|description=Learn about Program Structure in Clomosy! A guide to organizing and structuring your code for efficient mobile app development.}}

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.

{
  ...
}