Type Checking functions

For faster and efficient checking of the types of values, SRON provides 7 functions

  • isVoid()

  • isInt()

  • isDouble()

  • isChar()

  • isBool()

  • isCollective()

  • isString()

  • isList()

  • isFileReader()

  • isFileWriter()

  • isLiteralString()


1. isVoid():

This function returns true if the passed value is Void otherwise false.

{
    name : Main
    Any val = Void

    if : {
        condition : isVoid(val)
        println("Value is Void")
    }
    else : { 
        println("Value is not Void")
    }
}

OUTPUT:

Value is Void


2. isInt():

This function returns true if the passed value is of type 'Int' otherwise false.

OUTPUT:

Value is an integer


3. isDouble():

This function returns true if the passed value is of type 'Double' otherwise false.

OUTPUT:

Value is a decimal number


4. isChar():

This function returns true if the passed value is of type 'Char' otherwise false.

OUTPUT:

Value is a character


5. isBool():

This function returns true if the passed value is of type 'Bool' Void otherwise false.

OUTPUT:

Value is a boolean


6. isCollective():

This function returns true if the passed value is of type 'List' or 'String' otherwise false.

OUTPUT:

Value is of collective type


7. isString():

This function returns true if the passed value is of type 'String' otherwise false.

OUTPUT:

Value is a string


8. isList():

This function returns true if the passed value is of type 'List' otherwise false.

OUTPUT:

Value is a list


9. isFileReader():

This function returns true if the passed value is of type 'FileReader' otherwise false.

OUTPUT:

Value is a file reader


10. isFileWriter():

This function returns true if the passed value is of type 'FileWriter' otherwise false.

OUTPUT:

Value is a file writer


11. isLiteralString():

This function returns true if the passed value is of type 'LiteralString' otherwise false.

OUTPUT:

Value is a LiteralString


Last updated