Difference between revisions of "Eval"

203 bytes added ,  10:27, 26 May 2014
clarified
imported>Odessa
(Created)
 
imported>Odessa
(clarified)
Line 1: Line 1:
{{Function
{{Function
  |origin = NVSE
  |origin = NVSE
  |summary = Added by NVSE V4. Reduces an expression to a boolean for use in conditional statements. Used to permit the usage of any function or expression that may be so reduced.  
  |summary = Added by NVSE V4. Reduces an expression to a boolean for use in conditional statements. Used to permit the usage of any function or expression that may be so reduced for a conditional, when the compiler would otherwise disallow it.


Eval is required to test the value of [[User Defined Function|user defined functions]], and those related to [[Array Variables|arrays]] and [[String Variables|strings]] in conditionals.
Eval is required to test the value of [[User Defined Function|user defined functions]], and those related to [[Array Variables|arrays]] and [[String Variables|strings]] in conditionals.
Line 19: Line 19:
let aBeatles := ar_List JohnREF, PaulREF, GeorgeREF, RingoREF
let aBeatles := ar_List JohnREF, PaulREF, GeorgeREF, RingoREF


if eval (aBeatles[3] == RingoREF)
if eval (aBeatles[3] == RingoREF) ; * test the fourth element of array is Ringo
     ; Do something
     ; Do something
endif
endif




if eval (Ar_Size aBeatles > 0)
if eval (Ar_Size aBeatles > 0) ; * test array holds more than zero elements
     ; Do something
     ; Do something
endif
endif




if eval (Call SomeSuitableUDF)
if eval (Call SomeSuitableUDF) ; * test the user defined function returns true
     ; Do something
     ; Do something
endif
endif
Anonymous user