title: How to use AND or OR condition in when in Spark
body: <p>I wanted to evaluate two conditions in when like this :-</p>
  
  <pre class="lang-python prettyprint-override"><code>import pyspark.sql.functions as F
  
  df = df.withColumn(
      'trueVal', F.when(df.value &lt; 1 OR df.value2  == 'false' , 0 ).otherwise(df.value)) 
  </code></pre>
  
  <p>For this I get 'invalid syntax' for using 'OR'</p>
  
  <p>Even I tried using nested when statements :-</p>
  
  <pre class="lang-python prettyprint-override"><code>df = df.withColumn(
      'v', 
      F.when(df.value &lt; 1,(F.when( df.value =1,0).otherwise(df.value))).otherwise(df.value)
  ) 
  </code></pre>
  
  <p>For this i get <code>'keyword can't be an expression'</code> for nested when statements.</p>
  
  <p>How could I use multiple conditions in <code>when</code> any work around ?</p>