このページの翻訳:
- 日本語 (ja)
- English (en)
最近の更新
- 麻雀ルール [局の進行について]
- 01 ネットワーク設定nmcli [コネクションとデバイスを関連付け]
最近の更新
GASのグローバル変数は、参照はするけど変更を保存しておくことができない。
このようにすると、永続化してカウントし続ける事ができます。
var scriptProperties = PropertiesService.getScriptProperties();
var count = scriptProperties.getProperty('count');
function loadCount(){
var count = scriptProperties.getProperty("count");
if (!count) return 0;
count = Number(count) + 1
return count;
}
function saveCount(count) {
scriptProperties.setProperty("count", count);
}
function main(){
var count = loadCount();
Logger.log('count ' + count);
saveCount(count);
}