1 / 8

New Mexico Computer Science For All

New Mexico Computer Science For All. Statements and Expressions in NetLogo Maureen Psaila-Dombrowski. Statements and Expressions. Generally, a computer program is made up of two types of code: Statements Expressions. Statements. A statement is the smallest independent unit of code

shina
Download Presentation

New Mexico Computer Science For All

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. New Mexico Computer Science For All Statements and Expressions in NetLogo Maureen Psaila-Dombrowski

  2. Statements and Expressions • Generally, a computer program is made up of two types of code: • Statements • Expressions

  3. Statements • A statement is the smallest independent unit of code • Usually a statement produces an action

  4. Statements in NetLogo: Commands • Statements in NetLogo are called COMMANDS • There are many pre-defined commands (primitives) in NetLogo • Typically they begin with a verb, such as “create”, “forward”, “clear”, “hatch”.... ask turtles [ forward 1 ]

  5. Expressions • It is the smallest unit of calculation. • Expression represents or evaluates to a value • Single values (values, constant or variable) • Combinations of values interconnected with operators (25+12, a+b, x=y+12), or functions • If more than one operation occurs in an expression, the order of operations is used to determine the order they are performed in. • That value is what the computer uses instead of the expression.

  6. Expressions in NetLogo • Similar to other programming languages • Equals something (evaluates to something)

  7. Summary • There are two types of code: • Statements or Commands in NetLogo • The smallest independent unit of code • Produces an action • Expressions • The smallest unit of calculation • Produces (or evaluates to) a value

  8. Further Information • If you would like more information: • NetLogo Manual • NetLogo Dictionary

More Related