The if/else statement executes a block of code if a specified condition is true. If the condition is false, another block of code can be executed. The if/else statement is a part of JavaScript's "Conditional" Statements, which are used to perform different actions based on different conditions.
Use if to specify a block of code to be executed, if a specified condition is true. Use else to specify a block of code to be executed, if the same condition is false. Use else if to specify a new condition to test, if the first condition is false. Use switch to specify many alternative blocks of code to be executed.
if...else statement - executes some code if a condition is true and another code if that condition is false. if...elseif...else statement - executes different codes for more than two conditions. switch statement - selects one of many blocks of code to be executed.
One of my favourite alternatives to if...else is the ternary operator. Here expressionIfTrue will be evaluated if condition evaluates to true ; otherwise expressionIfFalse will be evaluated. The beauty of ternary operators is they can be used on the right-hand side of an assignment.
=IIf(Fields!TarifeTipiNo.Value = 265, "Saturday", IIf(Fields!TarifeTipiNo.Value = 266, "Monday", IIf(Fields!TarifeTipiNo.Value = 267, "Wednesday")))
I am trying to write expression into a cell in my report [rdlc file] but I just couldn't achieve this. If the cell is equal to 265 then Saturday should display or if it is equals to 266 then "Monday" should show up. Can someone help me out with it please?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With