From Clomosy Docs
No edit summary |
ClomosyAdmin (talk | contribs) No edit summary |
||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
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> | ||
<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> | ||
< | <br> | ||
<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!" | ||
<pre> | <pre> | ||
{ | { | ||
| Line 78: | Line 42: | ||
</pre> | </pre> | ||
This will produce following result<br> | This will produce following result<br> | ||
| Line 94: | 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 | * 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!'); | * The statement ShowMessage('Hello, World!'); displays the message "Hello, World!" on the screen using the ShowMessage function available in Clomosy. | ||
* The | * The final expression ( } ) ends your program. | ||
</div> | </div> | ||
| Line 105: | 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. | ||
* | * [[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. | ||
</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 with curly braces ({...}) in TRObject syntax.<br><br> | |||
<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
Hello World!
Let us look various parts of the above program
- 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.
Execute Clomosy Program
- 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.
- Download and 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.
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.
{
...
}