Skip to content

Commit

Permalink
doc: Document comparison expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
RomarQ committed Mar 11, 2022
1 parent 60d017a commit 151611f
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions documentation/docs/expressions/comparison.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Comparison

## LessThan

- [TypeDoc](https://romarq.github.io/smartts-sdk/api/modules/expression.html#LessThan-1)

```ts
const { Contract, EntryPoint, SetValue, ContractStorage, LessThan, TBool, TNat, Nat } = require('@tezwell/smartts-sdk');

const contract = new Contract()
.setStorageType(TBool())
.addEntrypoint(
new EntryPoint('ep1')
.setInputType(TNat())
.code((arg) => [
SetValue(ContractStorage(), LessThan(arg, Nat(1)))
]),
);
```

## LessThanOrEqual

- [TypeDoc](https://romarq.github.io/smartts-sdk/api/modules/expression.html#LessThanOrEqual-1)


```ts
const { Contract, EntryPoint, SetValue, ContractStorage, LessThanOrEqual, TBool, TNat, Nat } = require('@tezwell/smartts-sdk');

const contract = new Contract()
.setStorageType(TBool())
.addEntrypoint(
new EntryPoint('ep1')
.setInputType(TNat())
.code((arg) => [
SetValue(ContractStorage(), LessThanOrEqual(arg, Nat(1)))
]),
);
```

## GreaterThan

- [TypeDoc](https://romarq.github.io/smartts-sdk/api/modules/expression.html#GreaterThan-1)

```ts
const { Contract, EntryPoint, SetValue, ContractStorage, GreaterThan, TBool, TNat, Nat } = require('@tezwell/smartts-sdk');

const contract = new Contract()
.setStorageType(TBool())
.addEntrypoint(
new EntryPoint('ep1')
.setInputType(TNat())
.code((arg) => [
SetValue(ContractStorage(), GreaterThan(arg, Nat(1)))
]),
);
```

## LessThanOrEqual

- [TypeDoc](https://romarq.github.io/smartts-sdk/api/modules/expression.html#LessThanOrEqual-1)

```ts
const { Contract, EntryPoint, SetValue, ContractStorage, LessThanOrEqual, TBool, TNat, Nat } = require('@tezwell/smartts-sdk');

const contract = new Contract()
.setStorageType(TBool())
.addEntrypoint(
new EntryPoint('ep1')
.setInputType(TNat())
.code((arg) => [
SetValue(ContractStorage(), LessThanOrEqual(arg, Nat(1)))
]),
);
```

0 comments on commit 151611f

Please sign in to comment.