Changes between Version 10 and Version 11 of BoltRef


Ignore:
Timestamp:
Dec 12, 2007, 10:23:23 PM (17 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BoltRef

    v10 v11  
    166166== Nesting and functions ==
    167167
    168 
     168Control structures may be nested.
     169For example:
     170{{{
     171sequence(
     172    name("x");
     173    lesson(...),
     174    sequence(
     175        name("y"),
     176        lesson(...),
     177        exercise(...)
     178    )
     179);
     180}}}
     181
     182You can also use PHP functions as a way of organizing course structure:
     183
     184{{{
     185function my_unit() {
     186    return sequence(
     187        name("y"),
     188        lesson(...),
     189        exercise(...)
     190    )
     191}
     192
     193sequence(
     194    name("x"),
     195    lesson(...),
     196    my_unit()
     197);
     198}}}
    169199
    170200== Names and state ==
    171201
     202In general, units must have unique logical names.
     203However, two units may have the same logical name if they are identical.
     204For example:
     205{{{
     206function my_unit() {
     207    return random(
     208        name("y"),
     209        lesson(...),
     210        lesson(...)
     211    )
     212}
     213
     214return sequence(
     215    name("x"),
     216    my_unit(),
     217    exercise_set(
     218        name("z"),
     219        exercise(...),
     220        review(.5, my_unit())
     221    )
     222);
     223}}}
     224
     225This specifies a course in which my_unit() is displayed,
     226then an exercise is given.
     227If the student scores below .5 on the exercise,
     228he is shown my_unit() again and the exercise is repeated.
     229
     230So there are two units with logical name 'y' in this course,
     231but they are identical, so this is allowed.
     232
     233When there are multiple units with the same logical name,
     234they share a single state.
    172235
    173236== Control structures ==
    174237=== Sequences ===
    175238
    176 
     239Sequences were described above.
    177240
    178241=== Random ===