انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

Functions

Share |
الكلية كلية تكنولوجيا المعلومات     القسم قسم شبكات المعلومات     المرحلة 1
أستاذ المادة انوار جعفر موسى جعفر       13/05/2013 14:27:18
Function: function procedures and sub procedures share the same characteristics, with one important difference- function procedures return a value (e.g., give a value back) to the caller, whereas sub procedures do not. Function Procedures can be created with the add procedure dialog shown in figure by selecting function. Figure bellow shows a function procedure. Fact, created with the add procedure dialog. Fact implicitly returns variant.
Fact could also have been created by typing the function procedure directly into the code window.
The line
Private Function Fact() is the function procedure header. The header contains the keyword function, the function name and parentheses. The declarations and statements that the programmer will insert between the header and End Function form the function procedure body, Fact is invoked with the line.
Result= Fact( ) When a function procedure name (such as Fact) is encountered at run time, the function procedure is called, causing its body statements to execute. Consider the complete definition for Fact
Private Function Fact( N )
Fact=N^2
End Function
A function procedure return value is specified in the body by assigning a value to the function procedure name, as in Fact=N^2 Then returns (along with the value returned) to the calling statement
Result=Fact (N) And the return value is assigned to variable result. Program execution then continues with the next statement after the call to Fact. All function procedure definitions contain parentheses, the parentheses may be empty (e.g. Fact) or may contain one parameter variable declarations. Consider the following function procedure:

Private Function Area (s1 as single,s2 as single)
Area=s1*s2
End Function


المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
الرجوع الى لوحة التحكم