A function is a built-in formula or a ready made program which helps us to perform a certain task such as mathematical, financial, logical etc. A function manipulates data passes to it and returns either a string or a numeric value. There are two types of functions in QBASIC Programming.

  1. User defined function
  2. Built in function

User defined function: It is created by the programmer to perform the operations as per the requirements. It can be numeric or string function.

Built-in function: It is pre-defined program which is provided by QBASIC to perform some task easily. It gives many more built-in functions for manipulating strings, numbers. It makes our work easy. It is also known as Library functions. There are two types of built in function:

Video Tut for more info

Mathematical Functions String Functions
  • SQR : It calculate and return the square root of non-negative number
  • UCASE$ : It converts string values to uppercase.
  • MOD : It returns reminder, when one number is divide by another number.
  • LCASE$ : It converts string values to lowercase.
  • INT : It returns an integer of a given number.
  • LEFT$ : It extract and return the numbers of characters from the left of a string.
  • CINT : It returns nearest rounding numeric value from -32768 to 32767 as argument.
  • RIGHT$ : It extract and return the numbers of characters from the right of a string.
  • SGN : It returns the sign of numeric value.
  • MID$ : It is used to pick up the required strings from the string.
  • SIN : It returns the sign value of given number.
  • LTRIM$ : It is used to remove the spaces from the left of the string.
  • COS : It is used to obtain the cosine value of a number.
  • RTRIM$ : it is used to remove the spaces from the right of the string.
  • TAN : It returns the tangent of a number.
  • VAL : If both strings are started with numeric value. This function can perform mathematical calculations among them.
  • ABS : It returns corresponding positive value.
  • ASC : It returns ASCII value of a character.
  • CHR$ : It returns character value of given ASCII code.
  • STR$ : It converts numeric value to string value, which cannot be used for mathematical calculation.
  • SPACE$ : It is used to put blank space.
  • TAB : It is used to put Tab.
  • DATE$ : It returns the current date.
  • TIME$ : It returns the current time.
  • LEN : It returns the length of a given string.
  • STRING$ : It returns a string of a specified length made up of a repeating character.

<< Table of Content >>