IBM Lotus Symphony


‏‎Static Statement [Runtime]‎‏

تم تعريف متغير أو مصفوفة على مستوى الاجراء في البرنامج الفرعي أو الوظيفة، بحيث يتم الاحتفاظ بقيم المتغير أو المتجه بعد الخروج من البرنامج الفرعي أو الوظيفة. تكون تحويلات عبارة Dim statement أيضا صحيحة.

شارة التحذير لا يمكن استخدام Static statement لتعريف مصفوفات المتغيرات. يجب تحديد المصفوفات Arrays وفقا لحجم ثابت.

الصيغة:

Static VarName[(start To end)] [As VarType], VarName2[(start To end)] [As VarType], ...

مثال:

Sub ExampleStatic

Dim iCount as Integer, iResult as Integer

For iCount = 0 to 2

iResult = InitVar()

Next iCount

MsgBox iResult,0,"The answer is"

End Sub

REM Function for initialization of the static variable

Function InitVar() As Integer

Static iInit As Integer

Const iMinimum as Integer = 40 REM minimum return value of this function

if iInit = 0 then REM check if initialized

iInit = iMinimum

else

iInit = iInit + 1

end if

InitVar = iInit

End Function


التعليق التقييمي عن البرنامج | المزيد من المطبوعات الفنية | العلامات التجارية