Skip to content

Changelog

Notable Changes in Syntax from FRED 12 to FRED 13

  • The variables block is solely for variable declaration. Initialization must occur in a startup block or condition.
  • You can no longer declare multiple variables sequentially without specifying their type. E.g.) Use
    shared numeric x
    shared numeric y
    
    instead of
    shared numeric x y
    
  • It is invalid to use the old <var_name>.output_interval = <interval> syntax to set an output interval. To set the output interval of a variable that was declared in the variables block, use the new set_output_interval(<var_name>, <interval>) action.
  • It is invalid to use the old <table_variable>.default_value = <value> syntax to set a default value for a table. To set the default value, use the new set_default_value(<table_name>, <value>) action.
  • use:: modules and include keywords are no longer valid.
  • Condition-local variables are no longer valid.
  • Commented lines must begin with #. It's no longer valid syntax to use a comment block like comment {...}
  • The syntax for if statements, while loops, and for loops now omits redundant keywords like do and then. The new syntax is if (...) {...} else {...}, while(...) {...}, and for(...) {...}.
  • If statements must always include braces. There are no more one-liner if statments lacking braces.
  • Transition rules cannot appear inside of if statements. If you want to conditionally transition, use the new next_if(<state_name>, <clause>) action.
  • wait rules can no longer appear inside of an if statement. If you want to conditionally wait, use the new wait_if(<state_name>, <clause>) action.
  • with prob is no longer valid for if statements. Instead use the new next_with_prob(<state_name>, <probability>) action.
  • next is no longer a valid action. Use next_with_prob, next_if, or default to create the desired transition logic instead.
  • In output blocks, the path provided to the filename field is surrounded by quotes.
  • The index_values and filter_values actions now take an operator string surrounded by quotes as their second arguments. E.g.) my_results = index_values(my_list, "<=", 2)
  • In the print_file, print_csv, open_csv, read, read_table, read_list_table, read_container_file, read_agent_file, read_group_file, read_place_file, and read_schedule_file actions, the filename is now surrounded by quotes.
  • Logical AND operators are now represented with && and can be used anywhere an expression can be used.
  • Logical OR operators are now represented with || and can be used anywhere an expression can be used.
  • Using ! as a prefix for expressions is not considered valid syntax (e.g. if (!my_variable)...). Use not instead.
  • Only simple numbers/variables can be used in braces with tables currently. Use select if you want to use an expression as an index. If you want to assign the key, use set. This is somewhat unintuitive currently, so it'd probably be better to avoid using [ ] when possible.
  • Place definitions no longer have an elevation. Define sites like this: site = 0, 1.1, 2.2.
  • The syntax wherein you would pass an argument containing a period to some actions like total_count(condition_name.state_name) is now invalid. The new syntax separates the condition name from the state name with a comma, like total_count(condition_name, state_name). The condition name is no longer optional.
  • The same principle defined in the previous point applies to the period-separated args for current_count and daily_count.
  • If an action calls for a state's index, use the new get_state(<condition_name>, <state_name>) action.
  • Consider the syntax wherein you use braces to access keys of a table / elements of a list to be "unofficially" supported. This is subject to change and you cannot place most expressions inside of the braces, just simple variable names and numbers.
  • The syntax using the _ character, like in print("select(list(1, 2, 3, 4, 5), _>2)"), is now invalid. You'll have to use a for loop to achieve this functionality.
  • In accordance with the previous point, select_index, filter_agents, index_agents, and apply are no longer valid actions.
  • In accordance with the above, the forms of select and tell which used the _ character are no longer valid. You can replace syntax like:
    private_school_list = select(school_list, ask(_,private) > 0)
    
    with something like
    private_school_list = list()
    for (iter, school_list) {
        if(ask(iter,private) > 0) {
            push(private_school_list, iter)
        }
    }
    
  • No longer support \ to escape newlines.