このページの翻訳:
- 日本語 (ja)
- English (en)
最近の更新
- 03 Zed editor 設定 [Windowsでビルド]
- 09 ↷ 50_dialy:2025:09:09 から 50_dialy:2025:09:08 へページを名称変更しました。
- 06 ↷ 50_dialy:2025:06 から 50_dialy:2025:09:06 へページを移動しました。
最近の更新
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);
}