Operators "/=" and "/" giving different results?

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Scoox
Posts: 122
Joined: 11 May 2014, 09:12
Location: China

Operators "/=" and "/" giving different results?

12 Apr 2020, 11:05

Hi guys, I'm a bit confused, here are two bits of code, both divide 1 by 10 and assign it to a variable, but the first one gives the wrong value, why?

Code: Select all

MyVar := 1
MyVar /= 10
MsgBox %MyVar% ;Displays 0

MyVar := 1
MyVar := MyVar / 10
MsgBox %MyVar% ;Displays 0.100000
Thanks :D
teadrinker
Posts: 2180
Joined: 29 Mar 2015, 09:41
Contact:

Re: Operators "/=" and "/" giving different results?

12 Apr 2020, 11:16

Hi, read here.

Code: Select all

MyVar := 1.0
MsgBox % MyVar /= 10
gregster
Posts: 5820
Joined: 30 Sep 2013, 06:48

Re: Operators "/=" and "/" giving different results?

12 Apr 2020, 11:17

Especially, at the bottom of the box ;)

Code: Select all

MyVar := 1 , MyVar /= 10
MsgBox %MyVar% ;Displays 0.100000

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], boiler, bonswouar, Chemomancer, Google [Bot], kunkel321, mikeyww, vmech, Xtra and 40 guests