# Parse error on input ‘\<-’

**URL:** <https://forum.canton.network/t/parse-error-on-input/634>\
**Category:** App Development\
**Created:** [June 12, 2020, 6:54am UTC](https://forum.canton.network/t/parse-error-on-input/634 "2020-06-12T06:54:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![axnblue](https://avatars.discourse-cdn.com/v4/letter/a/35a633/32.png) [@axnblue](https://forum.canton.network/u/axnblue)\
**Post date:** [June 12, 2020, 6:54am UTC](https://forum.canton.network/t/parse-error-on-input/634/1 "2020-06-12T06:54:31Z")

</div>

```haskell
template PersonalContract
  with
    signat : Party
    h : Party
    number : Int
    

  where
    signatory signat

    controller hos can
      ExtraFunc : Optional (ContractId Demo)
        do
                  
          if number == 1
          then
            **temp <- create Demo with**
              signat = signat
              h = h

            return (Some temp)
          else
            return None

                      
          

template Demo
  with
    signat : Party
    h : Party

  where
    signatory signat

```

---

<div class="post-metadata">

**Author:** ![drsk](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/drsk/32/43_2.png) [@drsk](https://forum.canton.network/u/drsk)\
**Post date:** [June 12, 2020, 7:31am UTC](https://forum.canton.network/t/parse-error-on-input/634/2 "2020-06-12T07:31:16Z")

</div>

Hi @axnbl  
You’ll need a `do` after the `then`

```haskell
    controller hos can
      ExtraFunc : Optional (ContractId Demo)
        do
          if number == 1
          then do
            temp <- create $ Demo with signat = signat, h = h
            return (Some temp)
          else
            return None

```

---

<div class="post-metadata">

**Author:** ![axnblue](https://avatars.discourse-cdn.com/v4/letter/a/35a633/32.png) [@axnblue](https://forum.canton.network/u/axnblue)\
**Post date:** [June 12, 2020, 7:55am UTC](https://forum.canton.network/t/parse-error-on-input/634/3 "2020-06-12T07:55:45Z")

</div>

But it will create the Demo Contract. I dont want to create it unless or until number == 1. Is there any other way to do that?

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [June 12, 2020, 7:57am UTC](https://forum.canton.network/t/parse-error-on-input/634/4 "2020-06-12T07:57:33Z")

</div>

That’s exactly what @drsk’s example will do. Adding the `do` does no tchange the fact that it will only be created if the number is 1.

---

<div class="post-metadata">

**Author:** ![axnblue](https://avatars.discourse-cdn.com/v4/letter/a/35a633/32.png) [@axnblue](https://forum.canton.network/u/axnblue)\
**Post date:** [June 12, 2020, 7:58am UTC](https://forum.canton.network/t/parse-error-on-input/634/5 "2020-06-12T07:58:34Z")

</div>

ohh okay… got it

---

<div class="post-metadata">

**Author:** ![anthony](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/anthony/32/419_2.png) [@anthony](https://forum.canton.network/u/anthony)\
**Post date:** [June 17, 2021, 6:35pm UTC](https://forum.canton.network/t/parse-error-on-input/634/6 "2021-06-17T18:35:04Z")

</div>

Split this topic on June 17, 2021, 6:35pm UTC

2 posts were split to a new topic: [Can we put do blocks directly in templates?](https://forum.canton.network/t/can-we-put-do-blocks-directly-in-templates/2730)
