# Getting Started

## Getting Started with B2Win Suite Scripting

Before diving into the more advanced features, let's start with some basic examples to get you acquainted with the language.

### Example 1: Hello, World!

A classic "Hello, World!" example to display a greeting message:

```typescript
var message = "Hello, World!"
return message;
```

You will be able to see the returned value in real-time in the evaluation section below your code.

**Note:** By default, in the absence of an explicit `return` statement, scripts return the value of the last evaluated statement.&#x20;

Using the `return` keyword, a script will return the expression that follows (or null).

***

### **Example 2: Counting Down to Christmas**

For a more engaging and inclusive example, we can determine the number of days remaining until Christmas Day by utilizing the `now` and `of` methods in the [LocalDate class](/5.6/scripting/types-and-objects/objects/localdate.md), in combination with the `between` method from the [Duration class](/5.6/scripting/types-and-objects/objects/period.md). Here's how you can do it:

```java
var christmasDay = LocalDate.of(2023, 12, 25);
var currentDate = LocalDate.now();
var days = Duration.between(currentDate.atStartOfDay(), 
                                christmasDay.atStartOfDay()).toDays();
return days; // This will give you the count of days until December 25th, 2023.
```

With this code, you can effortlessly calculate the days left until the much-anticipated Christmas Day, set for December 25, 2023. It's a fun way to keep track of the holiday season!

***

### Example 3: Simple Arithmetic

You can perform basic arithmetic operations, like addition, subtraction, multiplication, and division. Here's an example:

```typescript
var num1 = 10;
var num2 = 5;

var sum = num1 + num2;
var difference = num1 - num2;
var product = num1 * num2;
var quotient = num1 / num2;

return [sum, difference, product, quotient];
// returns an Array: [15, 5, 50, 2]
```

This example showcases how to perform simple math operations and return the results.

***

### Example 4: Working with Strings

You can use and manipulate strings. Here's an example that combines strings:

```typescript
var firstName = "B2Win";
var lastName = "Suite";

var fullName = firstName + " " + lastName;

return fullName; // returns B2Win Suite
```

This example demonstrates string concatenation to create a full name.

***

### Example 5: Conditional Statements

Here's an example that checks if a number is even or odd:

```typescript
var number = 8;
var isEven = number % 2 == 0;

if (isEven) {
    return "The number is even.";
} else {
    return "The number is odd.";
}
```

***

### Example 6: Looping

Here's an example of a for loop to print numbers from 1 to 4:

```typescript
var sum = 0;
for (var i = 1; i < 5; i++) {
    sum = sum + i;
}
return sum; // sum is 10 (1+2+3+4)
```

Ready to explore more? Turn the page to [Language Basics](/5.6/scripting/language-basics.md) to continue building your understanding of B2Win Suite Scripting.


---

# 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://docs.b2winsuite.com/5.6/scripting/getting-started.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.
