Forum:Using If Statements with Variables

Hello; I'm wondering if there's anyway to write conditional statements in a Wiki template.

Right now I've got the hang of #if: (to check if a variable exists and print something, or print the alternative), and If_both (to check if both variables exist and print something).

But I'm not sure how to check the value, I only know how to check if variables exist. What I need is to check if x=1 or x=2 or x=3, so it can print the proper response. Also, is there anyway to check if x!=1 or x!=1. Adam weiler 19:53, September 27, 2011 (UTC)


 * I suggest you read the page about parser functions at MediaWiki (if you haven't allready): MW:Help:Parser functions
 * For the purpose you stated, checking the value of a variable and printing a response, you should try #ifeq: or #switch: depending on the circumstances. #ifexpr: may also be useful if you need to do some math with your variables. --Gardimuer { ʈalk } 20:39, September 27, 2011 (UTC)