# Getting integer value from variable

**URL:** <https://forum.robotframework.org/t/getting-integer-value-from-variable/4561>\
**Category:** Robot Framework\
**Created:** [22 August 2022 14:05 UTC](https://forum.robotframework.org/t/getting-integer-value-from-variable/4561 "2022-08-22T14:05:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rafael](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/rafael/32/1832_2.png) [@rafael](https://forum.robotframework.org/u/rafael)\
**Post date:** [22 August 2022 14:05 UTC](https://forum.robotframework.org/t/getting-integer-value-from-variable/4561/1 "2022-08-22T14:05:01Z")

</div>

Hello dudes!  
How have you been doing latelly?  
I’m trying to get the integer value form some float variables but I can’t. Like, I need the value before the dot. For example, if the value is 2.14, I need to get only the number 2. I have read the built in documentation but I couldn’t find any solution. Could anyone help me? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![René](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/ren%C3%A9/32/7_2.png) [@René](https://forum.robotframework.org/u/Ren%C3%A9)\
**Post date:** [22 August 2022 15:39 UTC](https://forum.robotframework.org/t/getting-integer-value-from-variable/4561/2 "2022-08-22T15:39:13Z")

</div>

Hi @rafael

Most of the cases the simple python `int()` should work.

You can either use `Evaluate` Keyword, or use `${{python eval}}`

https://robotframework.org/code/?codeProject=N4IgdghgtgpiBcIDCBXAzgFwPZQAQGMsATOAGhBLXwCcBLABw1qzARBHIDNaAbGNBAG1Q3PgDlocRBn4YAdNSwAjLBg4hCYGVrYAqfbgBqEOhCV80ufboA6YACTAoATwD6nHlggYAvrn+4jgCscgCc4RERPnYxYNa4ACqyuEgQaPxW+napmLRgAOa42LgAklp2AbgAygAWWCg8RLgAQjC4AKIAjigQPJWOwHkYABT2Lu6e3gCUPn4BwdFgse0Abr09TAUV805uQ3P+q+vebQFDo+MeXhhT2-619Y0tbV09fTvj+-3AQYsgPgBdcgkOgrGBEAAKigAVjB8Gp4JxeulyIoVBhDDBqGhmKxECEAAxyACM-yAA

Cheers

---

<div class="post-metadata">

**Author:** ![rafael](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/rafael/32/1832_2.png) [@rafael](https://forum.robotframework.org/u/rafael)\
**Post date:** [22 August 2022 21:01 UTC](https://forum.robotframework.org/t/getting-integer-value-from-variable/4561/3 "2022-08-22T21:01:37Z")

</div>

Thanks fella! You helped a lot with a so that simple solution I hadn’t thought about!

---

<div class="post-metadata">

**Author:** ![Timo](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@Timo](https://forum.robotframework.org/u/Timo)\
**Post date:** [27 August 2022 16:20 UTC](https://forum.robotframework.org/t/getting-integer-value-from-variable/4561/4 "2022-08-27T16:20:29Z")

</div>

Another option is to use Should Be Equal As Numbers, which has argument “precision”, which defines on which accurate (how many decimals) the comparison is done.
