3.2.8 Conditional Evaluation

CodeBlocks

[Contents] CodeBlocks Manual   [Search] Search

[Table of contents]

3.2.8 Conditional Evaluation


  $if(condition){true clause}{false clause}
Conditional evaluation will resolve to its true clause if
  • condition is a non-empty character sequence other than 0 or false
  • condition is a non-empty variable that does not resolve to 0 or false
  • condition is a variable that evaluates to true (implicit by previous condition)
Conditional evaluation will resolve to its false clause if
  • condition is empty
  • condition is 0 or false
  • condition is a variable that is empty or evaluates to 0 or false
Note:
Please do note that neither the variable syntax variants %if(...) nor $(if)(...) are supported for this construct.
Example
For example if you are using several platforms and you want to set different parameters depending on the operating system. In the following code the script commands of [[ ]] are evaluated and the <command> will be executed. This could be useful in a post-built step.
  [[ if (PLATFORM ==  PLATFORM_MSW) { print (_T("cmd /c")); } else { print (_T("sh ")); } ]] <command>


[Previous] 3.2.7  Operating System Commands
[Next] 3.3  Script expansion

Created: 2010/25/05 11:52   Updated: 2010/25/05 11:52
Author: HighTec EDV-Systeme GmbH
Copyright © 2010 HighTec EDV-Systeme GmbH