Skip to playerSkip to main content
  • 2 years ago
Types of Flowgorithm Functions
Transcript
00:00Logarithm functions are of two types, one intrinsic functions and the other one is the
00:10user-defined functions.
00:12So intrinsic functions are built-in functions that you can directly call in your flowchart
00:20and user-defined functions you need to define them in your flowchart, you need to define
00:26the program logic and invoke them in your flowcharts.
00:36In this video let's invoke a built-in function and see how we can call in your flowchart.
00:47So let's declare a variable called x of type real, prompt the user to enter the number.
01:07So take the input x.
01:15Now we will just invoke intrinsic or built-in logarithm function called abs which returns
01:24the absolute value.
01:26So we will define result x.
01:44So in the assign symbol we will specify the result and we will invoke the function with
01:53the parameter x.
01:56So this will call the built-in function abs and pass the value of x to the function, computes
02:07the value and returns the result to the variable called result on the left hand side.
02:16Click on okay, we will just output the value of the function using, just outputting the
02:31value of the variable result here.
02:43Let's run the function and see the output.
02:47Click on the play button.
02:52The absolute function if the number is positive returns the value as it is and if it is a
02:59negative number it returns the minus of the number.
03:04So the absolute function will always return a positive value.
03:10Let's run a sample test case here.
03:19So the result is 5.6.
03:21Let's run flowchart with the negative number, let's say minus of 2.5.
03:33We can see that the output of the function will be positive and notice that the absolute
03:44function always returns a positive value irrespective of the input variable x.
03:52When you invoke a function you need to pass the name, you need to provide the name of
03:59the function and pass the function parameters.
04:03If the function has more than one, you need to pass all the list of parameters as a comma
04:09separated.
04:11So when you invoke a function it will execute the code or the function logic and returns
04:19a value to the caller and that value will be stored in your flowchart variable that
04:26you provide in the left hand side.
04:31Coming back to this example, abs is the function name or the function name of the built-in
04:39function and we have provided the parameter x to the function.
04:44So the function executes itself and returns a value, that value will be stored in the
04:53flowchart variable called result in this example, okay.
04:59Hope you understood about built-in function, abs is just one built-in function in flowchart.
05:06There are several other intrinsic functions available, we will explore them in upcoming
05:12videos.
05:14If you like this video, subscribe to the channel.
05:18Thanks for watching.
Be the first to comment
Add your comment

Recommended