operation with integer

Discussion, questions and support.
Post Reply
Mr.Aky
Posts: 22
Joined: May 21st, ’19, 06:49

Post by Mr.Aky » Sep 19th, ’23, 05:44

I need to know the integer part of a division.
For example in this code, why the second message (the variable var4) is 2.5 and
not 2 ?

Code: Select all

var1 := 5
var2 := 2

var3 := var1 / var2
var4 := integer (var1 / var2)


MsgBox, %var3%
MsgBox, %var4%
User avatar
Marko
Posts: 1803
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Sep 19th, ’23, 20:54

There is no Integer function in AutoHotkey, use Round function instead. Also, there should be no space between function name and parentheses.
https://www.autohotkey.com/docs/v1/lib/Math.htm#Round

Code: Select all

var4  :=  round(var1 / var2)
Mr.Aky
Posts: 22
Joined: May 21st, ’19, 06:49

Post by Mr.Aky » Sep 20th, ’23, 06:06

User avatar
Marko
Posts: 1803
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Sep 20th, ’23, 18:14

FastKeys currently supports AutoHotkey v1.
https://www.autohotkey.com/docs/v1/
Post Reply