asp – How to concatenate conditions across multiple lines?

Question:

I'm working with a legacy system and it has some IF's with many conditions, with the intention of improving the readability of the code I tried to break these conditions in several lines..

If rs(0) = "Visualizar NF" 
  And Session("idPerfil") <> "19" 
  And Session("idPerfil") <> "10" 
Then

The above snippet generates the following error:

Erro de compilação do Microsoft VBScript erro '800a03f9' 

'Then' esperado 

I would like to know how in ASP 3.0 we can concatenate different conditions in decision structures or loops of repetition?

Answer:

Classic ASP expects the Then at the end of the same line to interpret the end of the condition, to concatenate the conditions in several lines we need to use the _ .

By adding the underscore _ to the end of each line the code will be interpreted correctly.

Example:

If rs(0) = "Visualizar NF" _
  And Session("idPerfil") <> "19" _
  And Session("idPerfil") <> "10" 
Then
Scroll to Top