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 instead of
- 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 newset_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 newset_default_value(<table_name>, <value>)action. use::modules andincludekeywords 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 likecomment {...} - The syntax for
ifstatements,whileloops, andforloops now omits redundant keywords likedoandthen. The new syntax isif (...) {...} else {...},while(...) {...}, andfor(...) {...}. - 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. waitrules can no longer appear inside of anifstatement. If you want to conditionally wait, use the newwait_if(<state_name>, <clause>)action.with probis no longer valid forifstatements. Instead use the newnext_with_prob(<state_name>, <probability>)action.nextis no longer a valid action. Usenext_with_prob,next_if, ordefaultto create the desired transition logic instead.- In output blocks, the path provided to the filename field is surrounded by quotes.
- The
index_valuesandfilter_valuesactions 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, andread_schedule_fileactions, 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)...). Usenotinstead. - Only simple numbers/variables can be used in braces with tables currently. Use
selectif you want to use an expression as an index. If you want to assign the key, useset. 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, liketotal_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_countanddaily_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 inprint("select(list(1, 2, 3, 4, 5), _>2)"), is now invalid. You'll have to use aforloop to achieve this functionality. - In accordance with the previous point,
select_index,filter_agents,index_agents, andapplyare no longer valid actions. - In accordance with the above, the forms of
selectandtellwhich used the_character are no longer valid. You can replace syntax like: with something like - No longer support
\to escape newlines.