--- title: "toInt" description: "Tries to coerce value into an integer (32-bit integer)." --- # toInt > Tries to coerce value into an integer (32-bit integer). **This function is used by Ignition's Expression language.**. ## Description Tries to coerce value into an integer (32-bit integer). If value is a number, the conversion is direct (with possible loss of precision). If value is a string, it is parsed to see if it represents an integer. If not, type casting fails. Will round if appropriate. ## Syntax `toInt(value[, failover])` - Parameters - object **value** - The value to type cast. - object **failover** - Optional. The failover value if type casting fails. - Results - int - The value type cast as an int. ## Examples ```python title="Code Snippet" toInt("38") //returns 38 ``` ```python title="Code Snippet" toInt("33.9") // returns 34 ``` ```python title="Code Snippet" toInt({Root Container.TextField.text}, -1) //returns the value in the text box as an int, or -1 if the value doesn't represent an number. ```