Is there a way to increase and decrease 2 values by 1, and saving those values to be used the next time that function run

I’m a beginner programmer looking to make a Twitter bot for 2 reasons. 1. to learn and get comfortable with Java and 2. Splatoon 3 just got announced and I want to make a funny gimmick account ūüôā I know the basics of Java, I have a Twitter API and app functional, and a make shift environment made from a google sheets tweet scheduler.

The bot sends out a tweet everyday counting down the days until 2022 (the first possible day for the game to release) and counting up the days since the games first trailer in the latest Nintendo Direct

I need help finding a way to decrease and increase the values respectively and saving those values to be used the next time the function is run

The code:

function tweetS3DaysLeft()
{
 
 console.log("Starting...");

 let spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
 let sheet = spreadsheet.getSheetByName("tweetS3DaysLeft");
 
 console.log("Sending tweet...");

//Starting values for the dates

 let DaysUntil = 316
 let DaysFrom = 1

 //Increase and decrease dates

 DaysUntil = DaysUntil - 1
 DaysFrom = DaysFrom +1
 
 // Build the tweet

 let tweetText = "Splatoon 3 is at least " + DaysUntil + " days until launch, and has been " + DaysFrom + " days since the first trailer";

 // Tweet

 sendTweet(tweetText);
 
  }

Any tips or links are appreciated. Thank you

21 thoughts on “Is there a way to increase and decrease 2 values by 1, and saving those values to be used the next time that function run”

Leave a Comment