The formulation you have for the second if statement will always evaluate to true if reached.
If you look at your condition:
(0<=x)< 2
(0<=x) will evaluate to 1 if true or 0 if false. Both 1 and 0 are less than 2.
So will always evaluate to true because 1 < 2 is true and 0 < 2 is also true.
Attached is the proper way to perform that condition in SMATH
2.sm (7 KiB) downloaded 35 time(s).Also the way that you have formulated the if statement f(2) will result in an error because none is not defined. If that's what you intend, that's fine. Otherwise you'd need equality <= or >= in the 2,3 if statement, respectively.
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW