inlist( ) 函数示例

下面的示例用 inlist( ) 函数来判断当前月份属于一年中的哪一个季度,变量 gcmonth 中存储的是当前月份。每个 case 语句利用 inlist( ) 函数来判断 gcmonth 的值是否包含在一个月份列表中,返回的季度名称保存在变量 gcreportitle 中。

set talk on
store cmonth(date( )) to gcmonth
do case
case inlist(gcmonth,'january','february','march')
store 'first quarter' to gcreportitle
case inlist(gcmonth,'april','may','june')
store 'second quarter' to gcreportitle
case inlist(gcmonth,'july','august','september')
store 'third quarter' to gcreportitle
otherwise
store 'fourth quarter' to gcreportitle
endcase
wait window gcreportitle