Mint Programming Language Tutorial - Part 3

Mint is the Language used for programming in Baldor Motion Products.We have already understood the basics of Mint Language and the Use / Declaration of Arrays in Mint Language. Today in this programming tutorial we will understand about the scope of variables , decision making structure and if else loops.

Understanding Scope of Variables in Baldor MintMT Language :-

As variables are the key part of program used for calculations and data values. Scope of a variable defines which parts of the program are aware of its existence.If we Declare a variable in the Parent Task (main program) than it has ‘Global’ scope i.e can be ‘seen’ from anywhere in the program.If we Declare a variable in a local procedure (subroutine, function, child task etc..) then it can only be ‘seen’ within that procedure. Also Mint Software have the feature to see variables value in the variable watch window BUT Variable watch window can only ‘see’ global variables and variables defined by child tasks.
As with variables also Subroutines and Functions can also have scope depending on where they are declared.

As Mint language is specifically designed for Motion Controlling so MintMT supports Basic style ‘decision making’ control structures such as….
IF..THEN
IF..THEN..ELSE IF..ELSE
FOR..NEXT
REPEAT..UNTIL
WHILE..END WHILE

If there are no decision making elements in a program then it will flow through statements left to right, top to bottom. The power and flexibility of any programming language comes from it’s ability to change statement order via structures and loops.

Declaration and Use of Decision Making Control Structure in Mint :-
||If…Then||
Use an If…Then structure to execute one or more statements conditionally. You can use either a single line syntax or a multiple line block syntax:
Syntax :- If condition Then statement
OR
If condition Then
statement
statement
End If

||If…Then...Else If…||
Use an If…Then..Else If structure to define several blocks of statements, one of which will execute:

If condition1 Then
statement1
Else If condition2 Then
statement2
Else If condition3 Then
statement3
Else
statement4
End If

There is one better alternative to If…Then…Else If… known as Case control structure , see its declaration in Mint below :-
||Select Case||
Select Case testexpression
Case expression1
statement1
Case expression2
statement2
Case expression3
statement3
Case Else
statement4
End Select

Loop Structure Defining Procedure in Mint
||Loop Structures||
Loop…End Loop provided as a means to keep a section of code repeating indefinitely
Loop
nCounter = nCounter + 1
Wait = 1000
End Loop

For…Next works well when you know how many times you need to execute statements within a loop
For counter = start To end [Step increment]
statements
Next [counter]

Repeat…Until provides as a means to keep a section of code repeating until a condition becomes true:
Repeat
statements
Until condition

While…End While is similar to Repeat…Until but tests the condition first (note that Repeat…Until will always execute the internal statements at least once):
While condition
statements
End While

Also you can subscribe to get all latest updates and rest part of this tutorial.
Subscribe to Automation-Talk by Email.

Advertisements :-

1 comment:

  1. The Mint WorkBench is a absolute Windows foreground end for the Mint programming environment. The Program Navigator makes it a breeze to navigate the source code, no matter how complicated.

    toshiba direct coupon code

    ReplyDelete

Get New Updates

Enter your email address:

Delivered by FeedBurner

Receive all updates via Facebook. Just Click the Like Button Below