NinjaScript > Educational Resources > Basic Programming Concepts > Branching Commands |
|
Branching controls execution flow of your script. It allows you to branch into separate logical sequences based on decisions you make.
The if Statement An if statement allows you to take execute different paths of logic depending on a given condition.
The above example will print NinjaTrader to the NinjaTrader output window since x does equal 0.
The above example will print NinjaScript to the NinjaTrader output window.
The above example will print NinjaTrader Rules! to the NinjaTrader output window.
The switch Statement The switch statement executes a set of logic depending on the value of a given parameter.
The above example will print out x is equal to two to the NinjaTrader output window. |