## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# The int (expr) function

The int (expr) function returns the truncated numeric value by removing the digits to the right of the decimal point for the given argument that is the lowest integer of the given number that is returned. If a whole number is given as an argument, it is returned as such, whereas if a floating point number is given as an argument, it returns an integer value truncated towards zero. It does not round the argument value up or down. The following code block shows an example of an integer function:

`\$ vi intfunc.awkBEGIN    {    print "int(3.5678) = ", int(3.5678);    print "int(5.9876) = ", int(5.9876);    print "int(4)      = ", int(4);    print "int(-3.1234)= ", int(-3.1234);    print "int(-4)     = ", int(-4);`
`    }\$ awk -f intfunc.awk`

The output ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required