Ifs

From Odwiki

Jump to: navigation, search

This one of the odWiki CustomExpressions returns a string from a if()-like expression

string ifs(float i; string s1; string s2)
{
  if (i == 0) {
    return s2;
  } else {
    return s1;
  }
}

e.g.

hscript> fcur 1
hscript> echo `ifs($F==1,"one","not one")`
one
hscript> fcur 2
hscript> echo `ifs($F==1,"one","not one")`
not one

credit: AntioneDurr

© 2009 od[force].net | advertise