# Indentation sensitivity, case sensitivity, and field names vs variable names

**URL:** <https://forum.canton.network/t/indentation-sensitivity-case-sensitivity-and-field-names-vs-variable-names/2194>\
**Category:** App Development\
**Tags:** daml, syntax\
**Created:** [March 3, 2021, 1:15pm UTC](https://forum.canton.network/t/indentation-sensitivity-case-sensitivity-and-field-names-vs-variable-names/2194 "2021-03-03T13:15:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![krmmalik](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/krmmalik/32/1410_2.png) [@krmmalik](https://forum.canton.network/u/krmmalik)\
**Post date:** [March 3, 2021, 1:15pm UTC](https://forum.canton.network/t/indentation-sensitivity-case-sensitivity-and-field-names-vs-variable-names/2194/1 "2021-03-03T13:15:45Z")

</div>

I’ve been following the tutorials on the proposal accept pattern. I want to implement a situation with my smart contract where a `person` can create a `guild` that has multiple members.

So I setup the following template

```haskell
template Guild with
    guildname: Text
    creator: Party
    member: [Party]
  where
    signatory creator
    ensure length member >= 5 && DA.List.unique member

template Individual with
    person: Party
    name: Text
    guild: Guild
  where
    signatory person

    controller person can
      CreateGuild : ContractId Guild
        do
          create guild

```

and then the following script to test.

```haskell
-- RUN_GUILD_TEST SCRIPT

guildtest = do
  martin <- allocateParty "Martin"
  rita <- allocateParty "Rita"
  john <- allocateParty "John"
  michael <- allocateParty "Michael"
  sam <- allocateParty "Sam"
  james <- allocateparty "James"

let
    guild = Guild with
      guildname = "Ahi"
      creator = martin
      member = [rita, john, michael, sam, james]

guildCid <- submit martin do
    createCmd Individual
      with
        person = martin
        name: "Martin"
        guild: Guild
submit martin do
    exerciseCmd individualCid CreateGuild
pure()

```

I’m getting a parser error on the line that starts with “guildCid”.

(obligatory screenshot)

 ![Screenshot 2021-03-03 at 13.12.59](https://canada1.discourse-cdn.com/flex028/uploads/daml/original/2X/5/5171ad8309f0608900ed40aaa1dde9bd8f37ec1e.png)

I’m not sure what I am doing wrong?  
Martin should have the authorisation to create this contract. And I am calling the Guild contract ID. I don’t believe this is an indentation error.

Unless I am setting up this pattern the wrong way round?  
A `person` can form a `guild` . I don’t want the guild to form the person.

Some guidance please?

---

<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:** [March 3, 2021, 1:23pm UTC](https://forum.canton.network/t/indentation-sensitivity-case-sensitivity-and-field-names-vs-variable-names/2194/2 "2021-03-03T13:23:17Z")

</div>

Daml is indentation sensitive, all statements in a `do` block need to start at the same line. So indent the `let`, indent `guildCid` and indent the `submit`. There are a few other minor typos:

1. `allocateParty` not `allocateparty`
2. `name = "Martin"` not `name: "Martin"`
3. `guild = guild` not `guild: Guild`
4. `individualCid` does not exist, I assume you mean `guildCid` created above.

Putting all things above, the following script should do the trick:

```haskell
guildtest = do
  martin <- allocateParty "Martin"
  rita <- allocateParty "Rita"
  john <- allocateParty "John"
  michael <- allocateParty "Michael"
  sam <- allocateParty "Sam"
  james <- allocateParty "James"

  let
    guild = Guild with
      guildname = "Ahi"
      creator = martin
      member = [rita, john, michael, sam, james]

  guildCid <- submit martin do
    createCmd Individual
      with
        person = martin
        name = "Martin"
        guild = guild
  submit martin do
    exerciseCmd guildCid CreateGuild
  pure()

```

---

<div class="post-metadata">

**Author:** ![krmmalik](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/krmmalik/32/1410_2.png) [@krmmalik](https://forum.canton.network/u/krmmalik)\
**Post date:** [March 3, 2021, 1:34pm UTC](https://forum.canton.network/t/indentation-sensitivity-case-sensitivity-and-field-names-vs-variable-names/2194/3 "2021-03-03T13:34:27Z")

</div>

Thank you so much @cocreature, it is working, but why does guild = guild ? Is it because I am calling guild from the second line after the `let` statement?

---

<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:** [March 3, 2021, 1:37pm UTC](https://forum.canton.network/t/indentation-sensitivity-case-sensitivity-and-field-names-vs-variable-names/2194/4 "2021-03-03T13:37:37Z")

</div>

`guid = guild` assigns the field called `guild` of the `Individual` you are created to the variable called `guild` which you are defining in the `let` above. There is actually also a shorthand for this, you can just write `guild` instead of `guild = guild` or use `..` to fill in all fields not set otherwise that way.

First option:

```haskell
  guildCid <- submit martin do
    createCmd Individual
      with
        person = martin
        name = "Martin"
        guild

```

Second option

```haskell
guildCid <- submit martin do
    createCmd Individual
      with
        person = martin
        name = "Martin"
        ..

```

---

<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:** [March 5, 2021, 9:36am UTC](https://forum.canton.network/t/indentation-sensitivity-case-sensitivity-and-field-names-vs-variable-names/2194/5 "2021-03-05T09:36:46Z")

</div>

Split this topic on March 5, 2021, 9:36am UTC

A post was split to a new topic: [Variable not in scope: submitMulti](https://forum.canton.network/t/variable-not-in-scope-submitmulti/2208)
