Parse error on input ‘<-’
App Development6 posts2,201 views5 likesLast activity Jun 2021
AX
axnblueOP
Jun 2020template 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
DR
drsk
Jun 2020Hi @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
AX
axnblue
Jun 2020But 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?
CO
cocreature
Jun 2020That’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.
AX
axnblue
Jun 2020ohh okay… got it
AN
anthony
Jun 20212 posts were split to a new topic: Can we put do blocks directly in templates?