#header-inner {background-position: right !important; width: 100% !important;}

8/2/14

Conditional Instruction & Expressions.

Conditional Instruction 'if' consists of:


1. Conditional expression that evaluates to a boolean value (truth or falsehood).

for example: ( o.getA() > 0 ) might be an expression that evaluates to boolean value.
for example: o.containsData() might be expression that evaluates to boolean value.
for example: ( o != null && o.containsData() && o.getA() > 0 ) might be expression that evaluates to boolean value.


2. Instruction to execute in case of truth.

for example: return; // a valueless return statement.
for example: { } // empty instruction.
for example: doSomething(); // function call.
for example { doSomething(1); doSomething(); } // complex instruction consisting of two function calls, with similar function signatures.


3. Syntax.

syntax is method of writing.

syntax can be varied depending on Programming Language, but has to be unambiguous.

for example: if (a = 0) then doSomething();
for example: if (a == 0) { doSomething(); }
for example: if ( (a == 0) iff (b > 3) ) { doSomethingUseful() }


See also: Logical Operators, How computers 'think', or conditional instruction 'if' explained, Lazy evaluation.

1 comment:

  1. (EN) conditional instruction 'if' = (PL) instrukcja warunkowa 'if'.

    ReplyDelete