# istype proc

Source: https://ref.dm-lang.org/proc/istype

### Format
- `istype(Val,Type)`
- `istype(Val)`


### Returns
> 1 if Val is derived from Type; 0 otherwise.

### Args
- `Val`: An object instance.
- `Type`: An object prototype or instance. If no type is specified and a variable was passed in as the first argument, it will default to the declared type of the variable.


If you don't have an object instance to test, but just want to see if one prototype derives from another one, use [ispath()](https://ref.dm-lang.org/proc/ispath.md) instead.

```dm /istype/
var/M
M = new/mob/ugly/duckling()
if(istype(M,/mob/ugly))  //this will be true
  usr << "[M] is ugly!"
```

Using implicit types, that same example can be rewritten as follows:

```dm /istype/
var/mob/ugly/M
M = new/mob/ugly/duckling()
if(istype(M))  //this will be true
  usr << "[M] is ugly!"
```

### See also
- [ispath proc](https://ref.dm-lang.org/proc/ispath.md)
- [locate proc](https://ref.dm-lang.org/proc/locate.md)
- [typesof proc](https://ref.dm-lang.org/proc/typesof.md)
- [astype proc](https://ref.dm-lang.org/proc/astype.md)
- [__IMPLIED_TYPE__ macro](https://ref.dm-lang.org/DM/preprocessor/__IMPLIED_TYPE__.md)
