Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Auto Increment


  • Please log in to reply
4 replies to this topic
Jackson
  • Guests
  • Last active:
  • Joined: --
How do increment a variable???

I tried searching for increment... but didnt find anything.

Basically:

x = x + 1

but that didnt work....

None
  • Members
  • 3199 posts
  • Last active: Apr 13 2014 02:11 AM
  • Joined: 28 Nov 2009
options :)
x:=x+1

x+=1

x++


SifJar
  • Members
  • 176 posts
  • Last active: Mar 19 2012 03:57 PM
  • Joined: 13 Feb 2010

How do increment a variable???

I tried searching for increment... but didnt find anything.

Basically:

x = x + 1

but that didnt work....


It'd need to be x = %x% + 1, because with the = assignment operator, plain text is taken as a string, you have to enclose variables in %.

To use x + 1, you'd have to use := assignment operator, which takes plain text to be a variable and strings must be enclosed in quotation marks (").

With both, numbers are just typed normally.

MasterFocus
  • Moderators
  • 4322 posts
  • Last active: Feb 05 2014 06:15 PM
  • Joined: 08 Apr 2009
Here's what you should read carefully:
<!-- m -->http://www.autohotke...s/Variables.htm<!-- m -->

  • Guests
  • Last active:
  • Joined: --
when I did x = %x% + 1, x then had: 1 + 1 because i had set x to be 1 in the start

but when i did x++ it worked.

Thanks