# Variables en AnyLogic

Usaremos una variable que permita contar el número de clientes que están en la agencia en cualquier momento durante la simulación. Para esto, cada vez que un cliente pasa por el bloque, **timeMeasureStart** la variable se incrementará y, cuando cualquier cliente pase por **timeMeasureEnd**, la variable se reducirá.

La creación de variables de diferentes tipos es una de las muchas fortalezas de AnyLogic (y aquí, si conoce Java, todas las posibilidades valen la pena). Cree una variable llamada **numClientesSistema** de tipo **int** (entero):

![](https://lh6.googleusercontent.com/Ku1v5-m7q5yhxXGWo2EM34WGiHvhhgUHzt4aLqgBoMe0fmThVlbwYi1SmJuuDgkftZrC7TsUV2RAOVTRZH4pb9N9S0dEe_ZQ7LbREVp_WBVAbzvmOOKdyPKUDCDJ00pp06w5SiX-)

No se preocupe por el **Initial Value** de las primitivas (**int**, **double**, **long** etc.): siempre es 0 (y para lo **boolean** es siempre **false**).

Luego, regrese al bloque **timeMeasureStart**. Observe el cuadro de diálogo **Action**, tiene una secuencia de líneas paralelas, similar al primer hexagrama del [I Ching](https://en.wikipedia.org/wiki/I_Ching) (*"The Creative":  "Promueve el éxito sublime, favoreciendo a través de la perseverancia"*):

![](https://lh6.googleusercontent.com/gIJgtK40V0xwGvn4a6c1AnH-816qCPGn9lS1B2dA2IVO0_fYcLy3vlFSDoH7-Rfe2Px-QRCMLgy92RgH_T5MrmTuIC6Gj3XEW0zgRpUrqUkOH63Y7MtQMK7W2HGPC6c2uzafjvH7)

Cada vez que encuentre este hexagrama en AnyLogic, sepa, mi joven *padawan*, que el cuadro de diálogo acepta una o más líneas de comando.&#x20;

Por ejemplo, incrementaremos la variable **numClientesSistema** cada vez que un cliente pase por el bloque:

![](https://lh3.googleusercontent.com/7ioRVN-Eb6U6EBfKaqc4oY3whnfqy2B-COaxgrWYhaTknw4cISSe3f6hazFpxa15CmVu2AYW2fTBRcb0rUb-0-gUKOHBtll89GPAaPD_don6vU-JE30LGz2F1YnRL94AQsBSYRVQ)

**Importante**: los comandos ubicados en estos cuadros de diálogo siempre deben terminar con el "**;**" (**punto y coma**).&#x20;

También tenga en cuenta que las siguientes expresiones son equivalentes:

* **numClientesSistema = numClientesSistema + 1;**
* **numClientesSistema++;**
* **numClientesSistema + = 1;**

Ahora **disminuya** la misma variable en el bloque **timeMeasureEnd**:

![](https://lh3.googleusercontent.com/OrmNz5clGoP-5Jv3RiPFDADRdv-WflVKhn_EF6OhWZXcgQX1otX-xdWuDn4Ksr5LdmQ9sNTtFXH9PC_Y7ffNNLGOq_3A-BpVKS4LuuGDFqDg-IxF2-k-OdaARn2i0CP7wZ74KDrK)

Intente simular el modelo y verifique si las cosas funcionan correctamente.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tutorial.anylogicbrasil.com.br/tutorial-es/variaveis-no-anylogic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
