BSL:Manual: Difference between revisions

145 bytes removed ,  5 December 2015
→‎Compound statements: link fixes; let's not encourage weird syntax
(→‎fork: I suppose it's worth noting this bug with "fork")
(→‎Compound statements: link fixes; let's not encourage weird syntax)
Line 38: Line 38:
  }
  }


You can string them  one that uses the semicolon:
The purpose of doing this is to group some statements under either a function declaration (see [[#Declaration|Declaration]]) or an "if" statement (see [[#Conditional|Conditional]]). Such a group of statements is referred to as a block, and is also said to be in a scope. Traditionally in programming, anything inside a certain level of shared braces can be seen from elsewhere within those braces, or from within a scope inside that scope, but not from a scope outside that scope. This allows careful management of which code can alter which data. In BSL's case, there are certain issues with scope not being respected (see the [[#if|if statement]] section). Variables outside of all scopes (such as functions) are referred to as "globals".
{dmsg("Statement 1"); dmsg("Statement 2"); dmsg("Statement 3");}
 
The purpose of doing this is to group some statements under a header, which can be either a function declaration (see [[#Declaration|Declaration) or an "if" statement (see [[#Conditional|Conditional]]). Such a group of statements is referred to as a block, and is also said to be in a scope. Traditionally in programming, anything inside a certain level of shared braces can be seen from elsewhere within those braces, or from within a scope inside that scope, but not from a scope outside that scope. This allows careful management of which code can alter which data. In BSL's case, there are certain issues with scope not being respected (see the section on the [[#if|if]] statement). Variables outside of all scopes (such as functions) are referred to as "globals".


===Comments===
===Comments===