Type Checking functions

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

  • is_void()

  • is_int()

  • is_double()

  • is_char()

  • is_bool()

  • is_collective()

  • is_string()

  • is_list()


1. is_void():

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

{
    name : Main
    Any val = Void

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

OUTPUT:

Value is Void


2. is_int():

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

OUTPUT:

Value is an integer


3. is_double():

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

OUTPUT:

Value is a decimal number


4. is_char():

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

OUTPUT:

Value is a character


5. is_bool():

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

OUTPUT:

Value is a boolean


6. is_collective():

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

OUTPUT:

Value is of collective type


7. is_string():

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

OUTPUT:

Value is a string


8. is_list():

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

OUTPUT:

Value is a list


Last updated