{"id":5631,"date":"2022-04-22T22:43:42","date_gmt":"2022-04-22T13:43:42","guid":{"rendered":"https:\/\/auto-worker.com\/blog\/?p=5631"},"modified":"2024-04-30T23:42:21","modified_gmt":"2024-04-30T14:42:21","slug":"post-5631","status":"publish","type":"post","link":"https:\/\/auto-worker.com\/blog\/?p=5631","title":{"rendered":"GAS\u306e\u6761\u4ef6\u5206\u5c90\u300cIF\u6587\u300d\u306e\u4f7f\u3044\u65b9\u89e3\u8aac\uff01\u8907\u6570\u6761\u4ef6\u3084elseif\uff0felse\u306e\u4f7f\u3044\u5206\u3051\u3092\u7d39\u4ecb"},"content":{"rendered":"\n<p>Google Apps Script(GAS)\u3092\u4f7f\u3063\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u51e6\u7406\u3067\u306f\u3001if\u6587\u3092\u4f7f\u3063\u305f\u6761\u4ef6\u5206\u5c90\u306f\u975e\u5e38\u306b\u3088\u304f\u4f7f\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>GAS\u521d\u5fc3\u8005\u3092\u5bfe\u8c61\u306bif\u6587\u306e\u57fa\u672c\u3067\u3042\u308b\u6587\u6cd5\u304b\u3089elseif\u3001else\u3068\u3044\u3063\u305f\u8907\u6570\u6761\u4ef6\u306e\u5206\u5c90\u51e6\u7406\u306e\u4f7f\u3044\u65b9\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Google Apps Script\u3067\u6761\u4ef6\u5206\u5c90\u306f\u5fc5\u9808<\/h2>\n\n\n\n<p>Google Apps Script(GAS)\u3067\u3044\u308d\u3044\u308d\u306a\u51e6\u7406\u3092\u884c\u3046\u5834\u5408\u3001\u57fa\u672c\u7684\u306b\u300c\u7e70\u308a\u8fd4\u3057\u300d\u3068\u300c\u6761\u4ef6\u5206\u5c90\u300d\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3059\u308b\u5834\u5408\u306f\u3001\u30c7\u30fc\u30bf\u306e\u6570\u3060\u3051\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3092\u884c\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305d\u308c\u306b\u52a0\u3048\u3066\u3001GAS\u3067\u306f\u300c\u6761\u4ef6\u5206\u5c90\u300d\u304c\u975e\u5e38\u306b\u5927\u4e8b\u3067\u3001\u5fc5\u9808\u3068\u8a00\u3048\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30c7\u30fc\u30bf\u306b\u3088\u3063\u3066\u306f\u540c\u3058\u51e6\u7406\u3067\u306f\u306a\u304f\u3001\u6761\u4ef6\u306b\u3088\u3063\u3066\u306f\u901a\u5e38\u3068\u7570\u306a\u308b\u51e6\u7406\u304c\u5fc5\u8981\u306b\u306a\u308a\u3001\u305d\u306e\u6642\u306b\u4f7f\u3046\u306e\u304c\u6761\u4ef6\u5206\u5c90\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4f8b\u3048\u3070\u3001\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u4f8b\u984c\u3068\u3057\u3066\u3088\u304f\u4e0e\u3048\u3089\u308c\u308b\u300cFizzBuzz\u554f\u984c\u300d\u306f\u3001\u6570\u5b57\u3092\u51fa\u529b\u3057\u3066\u3044\u304d\u307e\u3059\u304c\u3001\u4ee5\u4e0b\u306e\u6761\u4ef6\u304c\u8a2d\u3051\u3089\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u6570\u5b57\u304c3\u306e\u500d\u6570\u306e\u6642\u306fFizz\u3068\u51fa\u529b<\/li>\n\n\n\n<li>\u6570\u5b57\u304c5\u306e\u500d\u6570\u306e\u6642\u306fBuzz\u3068\u51fa\u529b<\/li>\n\n\n\n<li>3\u306e\u500d\u6570\u304b\u30645\u306e\u500d\u6570\u306e\u6642\u306fFizzBuzz\u3068\u51fa\u529b<\/li>\n<\/ol>\n\n\n\n<p>\u3053\u308c\u306f\u3042\u304f\u307e\u3067\u4f8b\u984c\u3067\u3059\u304c\u3001GAS\u3067\u30b9\u30af\u30ea\u30d7\u30c8\u51e6\u7406\u3059\u308b\u969b\u306b\u3082\u3053\u3046\u3057\u305f\u6761\u4ef6\u5206\u5c90\u3092\u6d3b\u7528\u3059\u308b\u30b1\u30fc\u30b9\u304c\u307b\u3068\u3093\u3069\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">GAS\u306e\u6761\u4ef6\u5206\u5c90\u306e\u57fa\u672c\u306fif\u6587<\/h2>\n\n\n\n<p>Google Apps Script(GAS)\u306e\u6761\u4ef6\u5206\u5c90\u3067\u6700\u3082\u3088\u304f\u4f7f\u308f\u308c\u308b\u306e\u304c\u300cif\u6587\u300d\u3067\u3059\u3002<\/p>\n\n\n\n<p>if\u6587\u306f\u300c\u3082\u3057\u3007\u3007\u306a\u3089\u3001\u25a0\u25a0\u3092\u3059\u308b\u300d\u3068\u3044\u3046\u82f1\u8a9e\u3067\u7fd2\u3063\u305fIf\u69cb\u6587\u3068\u540c\u3058\u6d41\u308c\u3067\u51e6\u7406\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-luxe-blocks-syntaxhighlighter line-numbers language-javascript\"><code class=\"language-javascript\">if(\u6761\u4ef6\u5f0f){\n  \/\/\u6761\u4ef6\u5f0f\u3092\u6e80\u305f\u3059(true)\u3068\u304d\u306e\u51e6\u7406\u3092\u8a18\u8ff0\n}<\/code><\/pre>\n\n\n\n<p>if\u306e\u3042\u3068\u306e()\u62ec\u5f27\u5185\u306b\u542b\u307e\u308c\u308b\u6761\u4ef6\u3092\u6e80\u305f\u3059(True\/\u771f\u3067\u3042\u308b)\u5834\u5408\u306b\u3001\u4e2d\u62ec\u5f27\u5185\u306b\u66f8\u304b\u308c\u305f\u51e6\u7406\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>()\u62ec\u5f27\u5185\u306e\u6761\u4ef6\u3092\u6e80\u305f\u3055\u306a\u3044(Flase\/\u507d\u3067\u3042\u308b)\u5834\u5408\u3001\u4e2d\u62ec\u5f27\u5185\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u5b9f\u884c\u3055\u308c\u305a\u306b\u3001\u30b9\u30ad\u30c3\u30d7\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">if\u6587\u306e\u6761\u4ef6\u5f0f\u3067\u4f7f\u3046\u6bd4\u8f03\u6f14\u7b97\u5b50<\/h2>\n\n\n\n<p>if\u6587\u306e\u62ec\u5f27()\u5185\u306b\u8a18\u8ff0\u3059\u308b\u6761\u4ef6\u5f0f\u3067\u306f\u3001\u69d8\u3005\u306a\u6bd4\u8f03\u6f14\u7b97\u5b50\u3092\u7528\u3044\u3066\u6761\u4ef6\u5224\u5b9a\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>Google Apps Script\u3067\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u6bd4\u8f03\u6f14\u7b97\u5b50\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u300c==\u300d\uff1a\u5de6\u8fba\u3068\u53f3\u8fba\u304c\u7b49\u3057\u3044\u5834\u5408true\u3001\u7570\u306a\u308b\u5834\u5408false<\/li>\n\n\n\n<li>\u300c!=\u300d\uff1a\u5de6\u8fba\u3068\u53f3\u8fba\u304c\u7b49\u3057\u304f\u306a\u3044\u5834\u5408true\u3001\u7570\u306a\u308b\u5834\u5408false<\/li>\n\n\n\n<li>\u300c&lt;\u300d\uff1a\u5de6\u8fba\u304c\u53f3\u8fba\u3088\u308a\u3082\u5c0f\u3055\u3044\u5834\u5408true\u3001\u540c\u3058\u307e\u305f\u306f\u5de6\u8fba\u306e\u307b\u3046\u304c\u5927\u304d\u3044\u5834\u5408false<\/li>\n\n\n\n<li>\u300c\uff1e\u300d\uff1a\u5de6\u8fba\u304c\u53f3\u8fba\u3088\u308a\u3082\u5927\u304d\u3044\u5834\u5408true\u3001\u540c\u3058\u307e\u305f\u306f\u5de6\u8fba\u306e\u307b\u3046\u304c\u5c0f\u3055\u3044\u5834\u5408false<\/li>\n\n\n\n<li>\u300c&lt;=\u300d\uff1a\u5de6\u8fba\u304c\u53f3\u8fba\u4ee5\u4e0b\u306e\u5834\u5408true\u3001\u5de6\u8fba\u306e\u307b\u3046\u304c\u5927\u304d\u3044\u5834\u5408false<\/li>\n\n\n\n<li>\u300c\uff1e=\u300d\uff1a\u5de6\u8fba\u304c\u53f3\u8fba\u4ee5\u4e0a\u5834\u5408true\u3001\u5de6\u8fba\u306e\u307b\u3046\u304c\u5c0f\u3055\u3044\u5834\u5408false<\/li>\n\n\n\n<li>\u300c===\u300d\uff1a\u5de6\u8fba\u3068\u53f3\u8fba\u304c\u30c7\u30fc\u30bf\u578b\u542b\u3081\u7b49\u3057\u3044\u5834\u5408true\u3001\u7570\u306a\u308b\u5834\u5408false<\/li>\n\n\n\n<li>\u300c!==\u300d\uff1a\u5de6\u8fba\u3068\u53f3\u8fba\u304c\u30c7\u30fc\u30bf\u578b\u542b\u3081\u7b49\u3057\u304f\u306a\u3044\u5834\u5408true\u3001\u7570\u306a\u308b\u5834\u5408false<\/li>\n<\/ol>\n\n\n\n<p>Number\u578b\u306e\u6570\u5024\u5909\u6570\u306e\u5834\u5408\u306f\u3001\u5909\u6570\u306b\u4ee3\u5165\u3055\u308c\u3066\u3044\u308b\u6570\u5024\u304c\u7b49\u3057\u3044\u307e\u305f\u306f\u5927\u304d\u3044\u30fb\u5c0f\u3055\u3044\u3092\u6bd4\u8f03\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>String\u578b\u306e\u6587\u5b57\u5217\u5909\u6570\u306e\u5834\u5408\u306f\u3001\u540c\u3058\u6587\u5b57\u5217\u306e\u5185\u5bb9\u304b\u3001\u6570\u5b57\u30fb\u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u9806\u3067\u3069\u3061\u3089\u304c\u5148\u306b\u306a\u308b\u304b\u3067\u6bd4\u8f03\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>7\u306e\u300c===\u300d\u30848\u306e\u300c!==\u300d\u306f\u53b3\u5bc6\u7b49\u4fa1\u6f14\u7b97\u5b50\u3068\u3044\u3044\u3001\u5909\u6570\u306e\u5185\u5bb9\u306b\u52a0\u3048\u30c7\u30fc\u30bf\u578b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>1\u300c==\u300d\u306e\u7b49\u4fa1\u6f14\u7b97\u5b50\u306fNumber\u578b\u306e1\u3068\u3001\u6587\u5b57\u5217\u578b\u306e&#8221;1&#8243;\u3092\u540c\u3058\u3082\u306e\u3068\u6271\u3044true\u3068\u3057\u307e\u3059\u304c\u3001\u53b3\u5bc6\u7b49\u4fa1\u6f14\u7b97\u5b50\u306f\u7570\u306a\u308b\u3082\u306e\u3068\u3057\u3066false\u3068\u5224\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u7b49\u4fa1\u6f14\u7b97\u5b50\u3068\u53b3\u5bc6\u7b49\u4fa1\u6f14\u7b97\u5b50\u306f\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3067\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-autoworker-google-apps-script-gas-sikuli wp-block-embed-autoworker-google-apps-script-gas-sikuli\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"O6TCSpirIc\"><a href=\"https:\/\/auto-worker.com\/blog\/?p=918\">Google Apps Script\u3067\uff12\u3064\u306e\u6587\u5b57\u5217\u3092\u6bd4\u8f03\u3059\u308b\u65b9\u6cd5\uff5e\u7b49\u4fa1\u6f14\u7b97\u5b50\u3068\u53b3\u5bc6\u7b49\u4fa1\u6f14\u7b97\u5b50\u306e\u9055\u3044\u3092\u89e3\u8aac<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Google Apps Script\u3067\uff12\u3064\u306e\u6587\u5b57\u5217\u3092\u6bd4\u8f03\u3059\u308b\u65b9\u6cd5\uff5e\u7b49\u4fa1\u6f14\u7b97\u5b50\u3068\u53b3\u5bc6\u7b49\u4fa1\u6f14\u7b97\u5b50\u306e\u9055\u3044\u3092\u89e3\u8aac&#8221; &#8212; AutoWorker\u301cGoogle Apps Script(GAS)\u3068Sikuli\u3067\u59cb\u3081\u308b\u696d\u52d9\u6539\u5584\u5165\u9580\" src=\"https:\/\/auto-worker.com\/blog\/?p=918&#038;embed=true#?secret=V6CDIGaYjH#?secret=O6TCSpirIc\" data-secret=\"O6TCSpirIc\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">GAS\u306b\u304a\u3051\u308bif\u6587\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/h2>\n\n\n\n<p>\u5b9f\u969b\u306bGoogle Apps Script(GAS)\u3067if\u6587\u3092\u4f7f\u3063\u305f\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"520\" src=\"https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_001-1024x520.jpg\" alt=\"Google Apps Script\u3067\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u6761\u4ef6\u5206\u5c90\u3092\u884c\u3046if\u6587\u3092\u4f7f\u3063\u305f\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\" class=\"wp-image-5635\" srcset=\"https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_001-1024x520.jpg 1024w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_001-300x152.jpg 300w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_001-768x390.jpg 768w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_001-530x269.jpg 530w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_001-565x287.jpg 565w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_001-710x360.jpg 710w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_001-725x368.jpg 725w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_001.jpg 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-luxe-blocks-syntaxhighlighter line-numbers language-javascript\"><code class=\"language-javascript\">function myFunction() {\n  \/\/6\u306e\u6570\u5b57\u304c\u5165\u3063\u305f\u5909\u6570\u3067\u8272\u3005\u306aif\u6587\u306e\u6761\u4ef6\u5224\u5b9a\n  const num = 6;\n  \/\/6\u306f0\u3088\u308a\u3082\u5927\u304d\u3044\u305f\u3081\u3001if\u6587\u306ftrue\u3067\u51e6\u7406\u304c\u5b9f\u884c\n  if (num > 0){\n    console.log(num + '\u306f0\u3088\u308a\u3082\u5927\u304d\u3044\u6570\u5b57\u3067\u3059\u3002')\n  }\n  \/\/6\u306f3\u3088\u308a\u3082\u5927\u304d\u3044\u305f\u3081\u3001if\u6587\u306ffalse\u3067\u30b9\u30ad\u30c3\u30d7\n  if (num &lt; 3){\n    console.log(num + '\u306f3\u3088\u308a\u5c0f\u3055\u3044\u6570\u5b57\u3067\u3059\u3002')\n  }\n  \/\/6\u306f3\u306e\u500d\u6570\u306e\u305f\u3081\u3001if\u6587\u306ftrue\u3067\u51e6\u7406\u304c\u5b9f\u884c\n  if (num%3 == 0){\n    console.log(num + '\u306f3\u3067\u5272\u308a\u5207\u308c\u308b\u6570\u5b57\u3067\u3059\u3002')\n  }\n}<\/code><\/pre>\n\n\n\n<p>\u6700\u521d\u306b\u5b9a\u7fa9\u3057\u305fnum\u3068\u3044\u30466\u306e\u6570\u5024\u3092\u4ee3\u5165\u3057\u305f\u5b9a\u6570\u30673\u3064\u306eif\u6587\u3067\u6761\u4ef6\u5206\u5c90\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>GAS\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u6761\u4ef6\u3092\u6e80\u305f\u3057\u305fif\u6587\u306e\u307fconsole.log\u306e\u30ed\u30b0\u51fa\u529b\u304c\u884c\u308f\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"513\" src=\"https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_002-1024x513.jpg\" alt=\"Google Apps Script\u306eif\u6587\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u305f\u7d50\u679c\u3001\u6761\u4ef6\u5f0f\u304c\u771f(true)\u306b\u306a\u308b\u3082\u306e\u3060\u3051\u51e6\u7406\u304c\u5b9f\u884c\" class=\"wp-image-5636\" srcset=\"https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_002-1024x513.jpg 1024w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_002-300x150.jpg 300w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_002-768x385.jpg 768w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_002-530x265.jpg 530w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_002-565x283.jpg 565w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_002-710x356.jpg 710w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_002-725x363.jpg 725w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2022\/04\/202204200_auto_002.jpg 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u6761\u4ef6\u5f0f\u3092\u6e80\u305f\u3057\u305f1\u3064\u76ee\u306eif\u6587\u30683\u3064\u76ee\u306eif\u6587\u306e\u307f\u4e2d\u62ec\u5f27\u5185\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>6 &gt; 3\u3068\u6761\u4ef6\u5f0f\u3092\u6e80\u305f\u3057\u3066\u3044\u306a\u30442\u3064\u76ee\u306eif\u6587\u306ffalse\u306e\u305f\u3081\u3001\u51e6\u7406\u304c\u30b9\u30ad\u30c3\u30d7\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6761\u4ef6\u3092\u6e80\u305f\u3055\u306a\u3044(False)\u5834\u5408\u306b\u306felse\u51e6\u7406\u304c\u53ef\u80fd<\/h2>\n\n\n\n<p>\u524d\u8ff0\u3057\u305fif\u6587\u3067\u306f\u3001\u30ab\u30c3\u30b3\u5185\u306e\u6761\u4ef6\u5f0f\u3092\u6e80\u305f\u3057\u305f\u5834\u5408\u306b\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u3001\u6e80\u305f\u3055\u306a\u3044\u5834\u5408\u306f\u30b9\u30ad\u30c3\u30d7\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u305f\u3060\u3001\u6761\u4ef6\u5206\u5c90\u3067\u306f\u6761\u4ef6\u3092\u6e80\u305f\u3055\u306a\u3044(\u507d\/false)\u5834\u5408\u306e\u51e6\u7406\u3082\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<p>Google Apps Script(GAS)\u3082\u4ed6\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u540c\u69d8\u306belse\u6587\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-luxe-blocks-syntaxhighlighter line-numbers language-javascript\"><code class=\"language-javascript\">if(\u6761\u4ef6\u5f0f){\n  \/\/\u6761\u4ef6\u5f0f\u3092\u6e80\u305f\u3059(true)\u3068\u304d\u306e\u51e6\u7406\u3092\u8a18\u8ff0\n}else{\n  \/\/\u6761\u4ef6\u5f0f\u3092\u6e80\u305f\u3055\u306a\u304b\u3063\u305f(false)\u3068\u304d\u306e\u51e6\u7406\u3092\u8a18\u8ff0\n}<\/code><\/pre>\n\n\n\n<p>if\u6587\u306b\u8a18\u8ff0\u3055\u308c\u305f\u6761\u4ef6\u5f0f\u3092\u6e80\u305f\u3057\u305f\u5834\u5408\u306f\u3001if\u6587\u306e\u3042\u3068\u306e\u4e2d\u62ec\u5f27{}\u5185\u306e\u51e6\u7406\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>else\u6587\u306fif\u6587\u306e\u6761\u4ef6\u5f0f\u3092\u6e80\u305f\u3055\u306a\u304b\u3063\u305f\u5834\u5408\u306b\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>if-else\u6587\u306b\u3088\u3063\u3066\u3001\u6761\u4ef6\u304c\u771f(true)\u30fb\u507d(false)\u3044\u305a\u308c\u306e\u5834\u5408\u3082\u6761\u4ef6\u5206\u5c90\u3057\u305f\u51e6\u7406\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4f8b\u3048\u3070\u3001\u30b9\u30fc\u30d1\u30fc\u3084\u30b3\u30f3\u30d3\u30cb\u3067\u6d88\u8cbb\u7a0e\u3092\u8a08\u7b97\u3059\u308b\u3088\u3046\u306aGAS\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306bif-else\u6587\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-luxe-blocks-syntaxhighlighter line-numbers language-javascript\"><code class=\"language-javascript\">function calculateTax(item) {\n  \/\/\u5546\u54c1\u306e\u30ab\u30c6\u30b4\u30ea\u30fc\u304c\u98df\u6599\u54c1\u306e\u5834\u5408\n  if (item.category == \"\u98df\u6599\u54c1\" ) {\n    \/\/\u8efd\u6e1b\u7a0e\u7387\u3067\u6d88\u8cbb\u7a0e\u306f8%\n    return item.price * 1.08;\n  } else {\n    \/\/\u98df\u6599\u54c1\u4ee5\u5916\u306e\u5834\u5408\u306f\u901a\u5e38\u306e\u6d88\u8cbb\u7a0e\u306710%\n    return item.price * 1.1;\n  }\n}<\/code><\/pre>\n\n\n\n<p>if-else\u6587\u306b\u3088\u308b\u6761\u4ef6\u5206\u5c90\u3067\u3001true\/false\u305d\u308c\u305e\u308c\u306e\u30b1\u30fc\u30b9\u306b\u5fdc\u3058\u305f\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u306a\u304a\u3001else\u6587\u3092\u8a18\u8ff0\u3059\u308b\u969b\u306f\u3001\u524d\u6bb5\u306eif\u6587\u306e\u4e2d\u62ec\u5f27\u306e\u9589\u3058\u30ab\u30c3\u30b3\u306e\u884c\u306b\u66f8\u304f\u30b9\u30bf\u30a4\u30eb\u3068\u30011\u884c\u6539\u884c\u3057\u3066\u66f8\u304f\u30b9\u30bf\u30a4\u30eb\u306b\u3088\u304f\u5206\u304b\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3069\u3061\u3089\u3067\u3082\u554f\u984c\u306f\u306a\u3044\u306e\u3067\u3001\u30b3\u30fc\u30c9\u306e\u884c\u6570\u3084\u53ef\u8aad\u6027\u3092\u8003\u616e\u3057\u3066\u3001\u81ea\u5206\u304c\u8aad\u307f\u3084\u3059\u3044\u65b9\u3092\u9078\u3073\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8907\u6570\u6761\u4ef6\u306e\u6761\u4ef6\u5206\u5c90\u3092\u884c\u3046\u5834\u5408\u306felse if<\/h2>\n\n\n\n<p>\u3055\u304d\u307b\u3069\u306fif-else\u6587\u306f\u6761\u4ef6\u5f0f\u3092\u6e80\u305f\u3059or\u6e80\u305f\u3055\u306a\u3044\u306e2\u3064\u306e\u6761\u4ef6\u306b\u5206\u5c90\u3059\u308bGoogle Apps Script\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3055\u3089\u306b3\u3064\u4ee5\u4e0a\u306e\u6761\u4ef6\u5206\u5c90\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u308belse if\u6587\u3068\u3044\u3046\u306e\u304cGAS\u3067\u306f\u5229\u7528\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-luxe-blocks-syntaxhighlighter line-numbers language-javascript\"><code class=\"language-javascript\">if(\u6761\u4ef6\u5f0f1){\n  \/\/\u6761\u4ef6\u5f0f1\u3092\u6e80\u305f\u3059(true)\u3068\u304d\u306e\u51e6\u7406\u3092\u8a18\u8ff0\n}else if(\u6761\u4ef6\u5f0f2){\n  \/\/\u6761\u4ef6\u5f0f1\u304c\u6e80\u305f\u3055\u305a(false)\u3001\u6761\u4ef6\u5f0f2\u3092\u6e80\u305f\u3059(true)\u3068\u304d\u306e\u51e6\u7406\u3092\u8a18\u8ff0\n}else{\n  \/\/\u6761\u4ef6\u5f0f1,2\u3044\u305a\u308c\u3082\u6e80\u305f\u3055\u306a\u304b\u3063\u305f(false)\u3068\u304d\u306e\u51e6\u7406\u3092\u8a18\u8ff0\n}<\/code><\/pre>\n\n\n\n<p>else if\u306f\u300cif\u6587\u306e\u6761\u4ef6\u5f0f\u304cfalse\u304b\u3064\u3001elseif\u306e\u6761\u4ef6\u5f0f\u304ctrue\u306e\u5834\u5408\u3001\u51e6\u7406\u304c\u5b9f\u884c\u300d\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>if\u6587\u306e\u6761\u4ef6\u5f0f1\u3082else if\u6587\u306e\u6761\u4ef6\u5f0f2\u306e\u3044\u305a\u308c\u3082\u6e80\u305f\u3055\u306a\u3044\u5834\u5408\u306belse\u6587\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>else if\u6587\u306f\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306b\u3088\u3063\u3066\u306f\u300celseif\u300d\u3068\u30b9\u30da\u30fc\u30b9\u3092\u5165\u308c\u306a\u3044\u3082\u306e\u3084\u3001Python\u306e\u3088\u3046\u306b\u300celif\u300d\u3068\u8868\u73fe\u3059\u308b\u5834\u5408\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>GAS\u3067\u306felse\u3068if\u306e\u9593\u306b\u534a\u89d2\u30b9\u30da\u30fc\u30b9\u3092\u958b\u3051\u3066\u66f8\u304f\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067\u899a\u3048\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<p>\u4f8b\u3048\u3070\u3001\u6570\u5024\u578b\u5909\u6570\u304c\u3069\u306e\u7bc4\u56f2\u306b\u53ce\u307e\u308b\u304b\u6761\u4ef6\u5206\u5c90\u3067\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-luxe-blocks-syntaxhighlighter line-numbers language-javascript\"><code class=\"language-javascript\">function myFunction() {\n  \/\/6\u306e\u6570\u5b57\u304c\u5165\u3063\u305f\u5909\u6570\n  const num = 6;\n  \/\/if, else if, else\u306e3\u3064\u306e\u6761\u4ef6\u5206\u5c90 \n  if (num  > 9){\n    console.log(num + '\u306f9\u3088\u308a\u3082\u5927\u304d\u3044\u6570\u5b57\u3067\u3059\u3002')\n  }else if (num > 3){\n    console.log(num + '\u306f3\u3088\u308a\u5927\u304d\u304f9\u4ee5\u4e0b\u306e\u6570\u5b57\u3067\u3059\u3002')\n  }else{\n    console.log(num + '\u306f3\u4ee5\u4e0b\u306e\u6570\u5b57\u3067\u3059\u3002')\n  }\n}<\/code><\/pre>\n\n\n\n<p>\u6700\u521d\u306eif\u6587\u304cfalse\u306b\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u304b\u30899\u4ee5\u4e0b\u306e\u6570\u5b57\u3068\u306a\u308a\u3001else if\u30673\u3088\u308a\u5927\u304d\u3044\u3053\u3068\u304b\u3089\u3001\u300c6\u306f3\u3088\u308a\u5927\u304d\u304f9\u4ee5\u4e0b\u306e\u6570\u5b57\u300d\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306bif-else if\u3092\u4f7f\u3046\u3053\u3068\u30673\u3064\u4ee5\u4e0a\u306e\u6761\u4ef6\u5206\u5c90\u3092GAS\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u8868\u73fe\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u51e6\u7406\u304c\u8907\u96d1\u306b\u306a\u308b\u307b\u3069\u3001\u6761\u4ef6\u5206\u5c90\u306e\u30d1\u30bf\u30fc\u30f3\u304c\u5897\u3048\u308b\u306e\u3067\u3001else if\u306f\u3088\u304fGAS\u3067\u4f7f\u308f\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305f\u3060\u3001else if\u6587\u3092\u591a\u7528\u3057\u3059\u304e\u308b\u3068\u3001\u6761\u4ef6\u5206\u5c90\u304c\u591a\u304f\u306a\u3063\u3066GAS\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u8aad\u307f\u3065\u3089\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6761\u4ef6\u5206\u5c90\u6642\u306e\u51e6\u7406\u304c1\u3064\u306a\u3089\u4e2d\u62ec\u5f27\u3092\u7701\u7565<\/h2>\n\n\n\n<p>\u5148\u307b\u3069Google Apps Script\u306eif\u6587\u304cTrue\u3067\u3042\u308b\u5834\u5408\u306b\u3001\u4e2d\u62ec\u5f27\u306b\u56f2\u307e\u308c\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u3068\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u305f\u3060\u3001\u6761\u4ef6\u5206\u5c90\u6642\u306e\u51e6\u7406\u304c1\u3064\u306e\u5834\u5408\u306f\u3001if\u6587\u306e\u5f8c\u306b\u5b9f\u884c\u3057\u305f\u3044\u51e6\u7406\u3092\u66f8\u304f\u3053\u3068\u3067\u3001\u4e2d\u62ec\u5f27\u304c\u7701\u7565\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4e2d\u62ec\u5f27\u7701\u7565\u306b\u3088\u3063\u3066\u3001\u30b3\u30fc\u30c9\u306e\u884c\u6570\u3092\u6570\u884c\u6e1b\u3089\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3057\u304b\u3057\u3001\u6761\u4ef6\u5206\u5c90\u304c2\u3064\u4ee5\u4e0a\u306e\u8907\u6570\u6761\u4ef6\u3042\u308b\u51e6\u7406\u3092\u884c\u3046\u5834\u5408\u306f\u7701\u7565\u304c\u3067\u304d\u306a\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u307e\u305f\u3001\u4e2d\u62ec\u5f27\u304c\u3042\u308b\u3053\u3068\u3067\u3001\u6761\u4ef6\u5206\u5c90\u306e\u51e6\u7406\u304c\u3069\u3053\u304b\u3089\u3069\u3053\u307e\u3067\u304b\u5206\u304b\u308a\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>GAS\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u8aad\u307f\u3084\u3059\u3055\u3001\u53ef\u8aad\u6027\u3092\u9ad8\u3081\u308b\u305f\u3081\u3001if\u6587\u3067\u306f\u5fc5\u305a\u4e2d\u62ec\u5f27\u3092\u7528\u3044\u308b\u3068\u30eb\u30fc\u30eb\u5316\u3068\u3057\u3066\u304a\u304f\u306e\u304c\u30aa\u30b9\u30b9\u30e1\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u307e\u3068\u3081\u30fb\u7d42\u308f\u308a\u306b<\/h2>\n\n\n\n<p>\u4eca\u56de\u3001Google Apps Script(GAS)\u306e\u6761\u4ef6\u5206\u5c90\u306e\u69cb\u6587\u3068\u3057\u3066\u6700\u3082\u3088\u304f\u4f7f\u3046if\u6587\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>GAS\u3092\u4f7f\u3063\u305f\u51e6\u7406\u306f\u2460\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3068\u2461\u6761\u4ef6\u5206\u5c90\u304c\u57fa\u672c\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6761\u4ef6\u5206\u5c90\u3068\u3057\u3066\u3001\u6700\u3082\u5229\u7528\u983b\u5ea6\u304c\u9ad8\u3044\u306eif\u6587\u3067\u3001\u6761\u4ef6\u5f0f\u3092\u6e80\u305f\u3057\u305f\u5834\u5408\u3060\u3051\u3001\u51e6\u7406\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3055\u3089\u306belse\u6587\u3067if\u6587\u306e\u6761\u4ef6\u3092\u6e80\u305f\u3055\u306a\u304b\u3063\u305f\u5834\u5408\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u3001else if\u6587\u3092\u4f7f\u3046\u3053\u3068\u30673\u3064\u4ee5\u4e0a\u306e\u6761\u4ef6\u5206\u5c90\u304c\u5b9f\u88c5\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u65e5\u5e38\u7684\u306a\u696d\u52d9\u3092\u884c\u3046\u4e2d\u3067\u3082\u3053\u3046\u3057\u305f\u6761\u4ef6\u5206\u5c90\u3092\u884c\u3063\u305f\u4ed5\u4e8b\u3092\u884c\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u305d\u3046\u3057\u305f\u696d\u52d9\u3092GAS\u3067\u81ea\u52d5\u5316\u3059\u308b\u969b\u306b\u306f\u6761\u4ef6\u5206\u5c90\u306f\u5fc5\u9808\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>if\u6587\u3001else if\u6587\u3001else\u6587\u306e\u4f7f\u3044\u65b9\u3092\u30de\u30b9\u30bf\u30fc\u3057\u3066\u3001\u69d8\u3005\u306a\u6761\u4ef6\u306b\u5fdc\u3058\u305f\u51e6\u7406\u3092\u5b9f\u88c5\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Google Apps Script(GAS)\u3092\u4f7f\u3063\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u51e6\u7406\u3067\u306f\u3001if\u6587\u3092\u4f7f\u3063\u305f\u6761\u4ef6\u5206\u5c90\u306f\u975e\u5e38\u306b\u3088\u304f\u4f7f\u3044\u307e\u3059\u3002 GAS\u521d\u5fc3\u8005\u3092\u5bfe\u8c61\u306bif\u6587\u306e\u57fa\u672c\u3067\u3042\u308b\u6587\u6cd5\u304b\u3089elseif\u3001else\u3068\u3044\u3063\u305f\u8907\u6570\u6761\u4ef6\u306e\u5206\u5c90\u51e6\u7406\u306e\u4f7f\u3044 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5635,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[918,919,14,260,917],"class_list":["post-5631","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-gas","tag-else","tag-elseif","tag-gas","tag-if","tag-917"],"_links":{"self":[{"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5631"}],"version-history":[{"count":5,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5631\/revisions"}],"predecessor-version":[{"id":8797,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5631\/revisions\/8797"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/media\/5635"}],"wp:attachment":[{"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}