Statements: Block statement

The block statement combines multiple regular statements to a single, complex, statement.


{statement ... statement}


The block statements are used wherever your algorithm must execute multiple operations at once but only a single statement is allowed by Chora syntax. This applies, for example, to the if-else condition:

// If the operand is true, perform all following operations if ( operand1 ) { SomeView.Visible = false; OtherView.Visible = true; OtherView.Color = #FFFF00FF; }

Besides the function to group multiple statements together, every block statement serves as an individual scope for all enclosed local variables and arrays. In other words, the locally defined variables are valid within the block only. Outside the block, these definitions are not available. For example:

if ( operand1 ) { // Following variables are valid within this block only var rect v1 = SomeTextView.Bounds; var string v2 = SomeTextView.String; [ ... ] } var rect v1 = OtherTextView.Bounds; var string v2 = OtherTextView.String; [ ... ]