jade-if-else-unless-case

  • Post author:
  • Post category:其他



if else
- var lession = ['node','jade']
if lession
  if lession.length > 2
    p 1 #{lession.join(', ')}
  else if lession.length > 1
    p 2 #{lession.join(', ')}
  else
    p no lession
else
  p no lession
=>
<p>2 node, jade</p>


unless

其实就是if的反向的判断
- var isJade = true
unless !isJade   p #{lession.length} =>
<p>2</p>


case

在jade里面不写switch case,而是写

case when
- var name = 'jade'
case name
  when 'java': p Hi java
  when 'jade': p Hi jade
  when 'node': p Hi node
  when 'express': p Hi express
=>
<p>Hi jade</p>

转载于:https://www.cnblogs.com/wzndkj/p/9276286.html