Archive: A question regarding !if


A question regarding !if
It looks like outside section, we can only use !if instead of ${If}. But if I use !if outside of section like,

!if $promise == "true"
; win a million dollars
!else
; lose a million dollars

Within onInit, I already set $promise to be "true". However when the code above is run, it always goes to !else. It looks like $promise hasn't been got a chance to be set. Why? Thanks.


$promise is a variable, it can only be used at runtime (inside functions and sections)

use !define's ( ${foo} ) with !if / !ifdef


You need to use ${If} ... ${Else} ... ${EndIf} for run-time (see LogicLib.nsh).

Stu