Skip to content
CCPEDIAby Unity Nodes
App Development

Parse error on input ‘<-’

5 posts2,234 views5 likesLast activity Jun 2020

  1. axnblueOP
    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
    
    
  2. drsk 2

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

        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
    
    
  3. axnblue

    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?

  4. cocreature 2

    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.

  5. axnblue 1

    ohh okay… got it