當前位置:編程學習大全網 - 電腦編程 - 如何用r語言寫repeat語句

如何用r語言寫repeat語句

壹、循環和向量化

1、控制結構

(1)條件語句

if(條件) 表達式1 else 表達式2

(2)循環(loops)

for :for(變量 in 變量) 表達式

while while(條件)表達式

repeat repeat 表達式

三者略有區別:若知道終止條件(循環次數)就用for循環,若無法知道運行次數,則用while和repeat循環,repeat循環利用循環體的break語句跳出循環

  • 上一篇:編程ij
  • 下一篇:JAVA學到什麽程度才算入門
  • copyright 2024編程學習大全網