美文网首页
if else语句

if else语句

作者: JeremyL | 来源:发表于2018-04-01 04:35 被阅读12次

    if else语句使用格式

    1.
    if (test) {
    statement
    }
    
    2.
    if (test) {
    statement
    } else {
    statement
    }
    
    3.
    if ( test) {
    statement
    } else if ( test) {
    statement
    } else if ( test) {
    statement
    } else {
    statement
    }
    
    species=sample(c("human","mouse","rat"),1)
    species
    if(species=="human"){
      Annotated_data="org.Hs.eg.db"
      Abbreviation="hsa"
      print("human information")
    }else if(species=="mouse"){
      Annotated_data="org.Mm.eg.db"
      Abbreviation="mmu"
      print("mouse information")
    }else if(species=="rat"){
      Annotated_data="org.Rn.eg.db"
      Abbreviation="rno"
      print("rat information")
    }else{
      print("end up")
    }
    

    相关文章

      网友评论

          本文标题:if else语句

          本文链接:https://www.haomeiwen.com/subject/bnqocftx.html