Author Topic: Multiple return statements from function  (Read 1968 times)

eastofthesun882

  • Guest
Multiple return statements from function
« on: February 03, 2016, 06:02:35 pm »
Hi

Trying to return multiple statements...

...
render: function (ui) {
                    if (ui.cellData != ""){
                        if (ui.cellData < 10 )
                    {
                    return style: "font-weight:bold";
                    return ui.cellData + "$";
}
}               
}
...

How should that be handled?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
    • View Profile
Re: Multiple return statements from function
« Reply #1 on: February 03, 2016, 06:31:28 pm »
There can be only one return statement.

for basic version it's

return "<span style='font-weight:bold;'>" +  ui.cellData + "$</span>";

eastofthesun882

  • Guest
Re: Multiple return statements from function
« Reply #2 on: February 03, 2016, 07:31:24 pm »
Thanks!