Last active
August 29, 2015 14:27
-
-
Save round/33e8720bcf13b74727ac to your computer and use it in GitHub Desktop.
Increment a value up and down.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var up = true; | |
var value = 0; | |
var increment = 1; | |
var ceiling = 100; | |
var floor = -100; | |
if (up == true && value <= ceiling) { | |
value += increment | |
if (value == ceiling) | |
{up = false;} | |
} else { | |
up = false | |
value -= increment; | |
if (value == floor) | |
{up = true;} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment