Quick Question with if else statements

Hello,
I just wanted to see if I could reduce the following block of code to a
simple 1 liner…

if @map_company_name == 1
contact.Fields.Add(@cdoPR_Company, @companyname)
end

How can you do this? I thought I could perhaps use the tertiary
operators, but I’ve only used them for defining a variable, not for
executing a statement… Any suggestions?

Thanks!

  • Jeff M.

Jeff M. wrote:

if @map_company_name == 1
contact.Fields.Add(@cdoPR_Company, @companyname)
end

contact.Fields.Add(@cdoPR_Company, @companyname) if @map_company_name
== 1

or

@map_company_name == 1 and contact.Fields.Add(@cdoPR_Company,
@companyname)


Phlip

sweet, thanks!

contact.Fields.Add(@cdoPR_Company, @companyname) if @map_company_name
== 1

HTH