或EJS条件?

时间:2019-02-03 16:34:51

标签: html if-statement ejs

这两个语句均有效:

  <% if(currentUser.collegeLevel === "High School") { %>    
  <h1>  They have a High School Degree </h1>
  <% } %>


  <% if(currentUser.collegeLevel === "Associates Degree") { %>    
  <h1> They have an Associates Degree </h1>
  <% } %>

此声明无效

<% if(currentUser.collegeLevel === "Associates Degree" || "High School") { %>    


 <h1> They have either a High school or Associates Degree</h1>

  <%  } %>

OR功能为何不起作用?

1 个答案:

答案 0 :(得分:3)

它不起作用,因为OR不能与其他任何对象进行比较。

它应该像这样:

@Entity(tableName = Database.Table.CATEGORIES) data class Category( @PrimaryKey(autoGenerate = true) @ColumnInfo(name = ID) val id: Long = 0, @ColumnInfo(name = NAME) val name: String = "", @ColumnInfo(name = ICON_ID) val iconId: Int = 0, @ColumnInfo(name = COLOR) @ColorInt val color: Int = DEFAULT_COLOR )