Elmomc Multi-Axis Motion Controller-Maestro Uživatelský manuál Strana 94

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 313
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 93
Examples:
function int max_value = MAX_INT(int a, int b, int c)
int max_a_b
if(a>b)
max_a_b = a
else
max_a_b = b
end if
if(max_a_b > c)
max_value = max_a_b
else
max_value = c
end if
end function
This function, named MAX_INT, has three integer input arguments (a, b, c) and one
integer return argument (max_value). The function body includes one declaration-
statement (local integer variable max_a_b) and two if-else statements.
function [int min1, int min2] = MIN_2_INT(int a, int b, int c)
int max_a_b
int min_a_b
if(a>b)
max_a_b = a
min_a_b = b
else
max_a_b = b
min_a_b = a
end if
if(max_a_b > c)
min1 = min_a_b
min2 = c
else
min1 = a
min2 = b
end if
end function
This function, named MIN_2_INT, has three integer input arguments (a, b, c) and two
integer return arguments (min1, min2). Function body includes two declaration-
statements (local integer variables max_a_b and min_a_b) and two if-else statements.
The If function does not need to return arguments, it’s header does need to contain
any return argument. For example:
function foo()
// to do something’s
……
end function
This function does not return any values.
Maestro Software Manual MAXL Program Language
MAN-MASSW (Ver. Q)
5-32
Zobrazit stránku 93
1 2 ... 89 90 91 92 93 94 95 96 97 98 99 ... 312 313

Komentáře k této Příručce

Žádné komentáře