確ãã«ãããã¨è¦ã§ ããªãã ããï¼ã ã«ãªãã¾ããã æå³ã®ãªãã³ã¡ã³ãã¨ãã¦ãelse å¥ãã¨åé¤ãã¦ãã¾ã£ã¦è¯ãããã«ã¿ãã¾ãã ããããå®ã¯ãã®ãä½ãããªããã³ã¼ãã¯ã ããã°ã©ãã³ã°ï¼çè«ï¼çã«é¢ç½ãå´é¢ãæã£ã¦ãã ã®ã§ãç°¡åã«è¨äºã«ã¾ã¨ãã¦ã¿ããã¨æãã¾ãï¼è¨äºä¸ã§ã¯ Swift ã«ä¼¼ãæ¬ä¼¼ã³ã¼ãã使ç¨ãã¾ãï¼ã ãã¼ã¯ã¼ã if å¼ãç¶²ç¾ çãã¿ã¼ã³ããããåç §ééãå¯ä½ç¨ãã¢ããã¨åä½å else å¥ãçç¥ã§ããæ¡ä»¶ ä¾ãã°ã次ã®ã³ã¼ãä¾ãèãã¦ã¿ã¾ãï¼ let array: Array<Int> = ... var positiveArray: Array<Int> = [] // var = å¯å¤å¤æ° for x in array { if x > 0 { positiveArray.append(x) } else { // ä½ãããªã } } ããã§ã¯ array ã
{{#tags}}- {{label}}
{{/tags}}