Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:programmingblocks:logic [2018/02/26 17:02]
kniwwelino
en:programmingblocks:logic [2018/04/23 13:38] (current)
kniwwelino
Line 1: Line 1:
 +===== Logic =====
  
 +==== Blocks ====
 +=== If - then ===
 +{{:en:programmingblocks:logic_1.png|}}
 +
 +This block allows you to create a condition: only if the statement (condition) next to ''if'' is true, then the blocks next to ''then'' will be executed.
 +
 +You can customize this block and add multiple ''else if'' or an ''else'' by clicking on the ''+'' sign. Use the available options and drag and drop them to the right.
 +
 +{{:en:programmingblocks:logic_2.png|}} {{:en:programmingblocks:logic_3.png|}} {{:en:programmingblocks:logic_4.png|}}
 +
 +\\
 +=== Comparing two numbers ===
 +{{:en:programmingblocks:logic_5.png|}}
 +
 +With this block you can compare two numbers (to be added inside the holes). The result is either true or false.
 +
 +Options:
 +  * ''='': is equal to
 +  * ''≠'': is not equal to
 +  * ''<'': is smaller than 
 +  * ''≤'': is smaller or equal than 
 +  * ''>'': is larger than
 +  * ''≥'': is larger or equal than 
 +
 +\\
 +=== Logical operations ===
 +{{:en:programmingblocks:logic_6.png|}}
 +
 +This block allows you to make logical operations on two statements (conditions) (to be added inside the holes).
 +
 +Options:
 +  * ''and'': is true of both statements are true
 +  * ''or'': is true if at least one of both statements is true
 +
 +\\
 +=== Logical negation ===
 +{{:en:programmingblocks:logic_7.png|}}
 +
 +Returns true if the block on the right is false. Returns false if the block on the right is true.
 +
 +\\
 +=== True or false condition ===
 +{{:en:programmingblocks:logic_8.png|}}
 +
 +Represents either ''true'' or ''false''.
 +
 +\\
 +=== Null ===
 +{{:en:programmingblocks:logic_9.png|}}
 +
 +Returns the value ''null''. Can be used, for instance, to detect if a variable has already been initialised or not.
 +
 +\\
 +=== Shortcut for a condition ===
 +{{:en:programmingblocks:logic_10.png|}}
 +
 +This block checks a statement (condition) added to test. If the statement is true, then the blocks next to ''if true then'' are executed. If it is false, then the blocks next to ''if false then'' are executed.
 +
 +\\
 +==== Example ====
 +You can find a simple example for using the logic blocks in the sample project [[en:instructions:rockpaperscissors|]].