Example 3: Computing The Number Of Days In A Month; (Using Functions) - Crestron SIMPL+ Reference Manual

Language reference guide
Hide thumbs Also See for SIMPL+:
Table of Contents

Advertisement

Software
®
282
SIMPL+
Example 3: Computing the Number of Days in a
Month (Using Functions)
#SYMBOL_NAME "Compute Number of Days in a Month"
#ANALOG_INPUT MONTH;
#ANALOG_OUTPUT DAYS;
INTEGER_FUNCTION ComputeDaysInMonth(INTEGER Month)
{
// Note that this computation does NOT take into account leap
// year!
INTEGER Days;
SWITCH (Month)
{
CASE( 2): Days = 28; // February
CASE( 4): Days = 30; // April
CASE( 6): Days = 30; // June
CASE( 9): Days = 30; // September
CASE(11): Days = 30; // November
Default:
Days = 31;
}
Return(Days);
}
CHANGE MONTH
{
DAYS = ComputeDaysInMonth(MONTH);
}
Crestron SIMPL+
// All others
Language Reference Guide - DOC. 5797G
®

Advertisement

Table of Contents
loading

Table of Contents