================================================================================ Simple IfNever, IfAlways, Else: 1 ------------------------------ $$IfNever{} One $$Else{} Two $$EndIf{} $$IfAlways{} Three $$Else{} Four $$EndIf{} ------------------------------ Two Three ------------------------------ ================================================================================ Commands inside If statements ------------------------------ $$IfNever{} $$DebugEcho{One} $$Else{} $$DebugEcho{Two} $$EndIf{} $$IfAlways{} $$DebugEcho{Three} $$Else{} $$DebugEcho{Four} $$EndIf{} ------------------------------ Two Three ------------------------------ ================================================================================ Nested Always, Never, Else: 1 ------------------------------ $$IfAlways{} One $$IfNever{} Two $$Else{} Three $$EndIf{} Four $$Else{} Five $$EndIf{} ------------------------------ One Three Four ------------------------------ ================================================================================ Nested Always, Never, Else: 2 ------------------------------ $$IfNever{} One $$IfAlways{} Two $$Else{} Three $$EndIf{} Four $$Else{} Five $$EndIf{} ------------------------------ Five ------------------------------ ================================================================================ ElseIf: 1 ------------------------------ $$name = {Alex} $$IfEqual{$$name{} | Chris} No $$ElseIfEqual{$$name{} | Alex} Yes $$ElseIfEqual{$$name{} | Alex} No $$EndIf{} All done ------------------------------ Yes All done ------------------------------ ================================================================================ ElseIf: 2 ------------------------------ $$name = {Alex} $$IfEqual{$$name{} | Blair} No $$ElseIfEqual{$$name{} | Chris} No $$ElseIfEqual{$$name{} | Alex} Yes $$EndIf{} All done ------------------------------ Yes All done ------------------------------ ================================================================================ ElseIfNot ------------------------------ $$name = {Alex} $$IfEqual{$$name{} | Blair} No $$ElseIfNotEqual{$$name{} | Alex} No $$ElseIfNotEqual{$$name{} | Chris} Yes $$EndIf{} All done ------------------------------ Yes All done ------------------------------ ================================================================================ IfNumArgs ------------------------------ $$helper = {{ $$IfNumArgs{0} Zero! $$ElseIfNumArgs{1} One! $$Else{} More than one! $$EndIf{} }} $$helper{} $$helper{Alex} $$helper{Alex | Chris} ------------------------------ Zero! One! More than one! ------------------------------ ================================================================================ IfEmpty and IfNotEmpty ------------------------------ $$IfEmpty{} Yes $$EndIf{} $$IfEmpty{Hello} No $$EndIf{} $$IfEmpty{Hello} No $$EndIf{} $$IfNotEmpty{Hello} Yes $$EndIf{} ------------------------------ Yes Yes ------------------------------ ================================================================================ IfEqual and IfNotEqual ------------------------------ $$IfEqual{Hello | Hello} Yes $$EndIf{} $$IfEqual{Hello | Goodbye} No $$EndIf{} $$IfNotEqual{Hello | Hello} No $$EndIf{} $$IfNotEqual{Hello | Goodbye} Yes $$EndIf{} ------------------------------ Yes Yes ------------------------------ ================================================================================ IfStartsWith, IfNotStartsWith ------------------------------ $$IfStartsWith{Hello | Hello sailor} Yes $$EndIf{} $$IfStartsWith{Goodbye | Hello sailor} No $$EndIf{} $$IfNotStartsWith{Hello | Hello sailor} No $$EndIf{} $$IfNotStartsWith{Goodbye | Hello sailor} Yes $$EndIf{} ------------------------------ Yes Yes ------------------------------ ================================================================================ IfEndsWith, IfNotEndsWith ------------------------------ $$IfEndsWith{sailor | Hello sailor} Yes $$EndIf{} $$IfEndsWith{Hello | Hello sailor} No $$EndIf{} $$IfNotEndsWith{sailor | Hello sailor} No $$EndIf{} $$IfNotEndsWith{Hello | Hello sailor} Yes $$EndIf{} ------------------------------ Yes Yes ------------------------------ ================================================================================ IfIncludes, IfNotIncludes ------------------------------ $$IfIncludes{llo | Hello sailor} Yes $$EndIf{} $$IfIncludes{goodbye | Hello sailor} No $$EndIf{} $$IfNotIncludes{llo | Hello sailor} No $$EndIf{} $$IfNotIncludes{goodbye | Hello sailor} Yes $$EndIf{} ------------------------------ Yes Yes ------------------------------ ================================================================================ IfIncludesRegex, IfNotIncludesRegex ------------------------------ $$IfIncludesRegex{\d{2} | g | Hello 23 sailor} Yes $$EndIf{} $$IfIncludesRegex{\d{3} | g | Hello 23 sailor} No $$EndIf{} $$IfNotIncludesRegex{\d{2} | g | Hello 23 sailor} No $$EndIf{} $$IfNotIncludesRegex{\d{3} | g | Hello 23 sailor} Yes $$EndIf{} ------------------------------ Yes Yes ------------------------------ ================================================================================ IfEven and IfOdd ------------------------------ $$IfEven{16} Yes $$EndIf{} $$IfEven{17} No $$EndIf{} $$IfEven{Hello} No $$EndIf{} $$IfOdd{16} No $$EndIf{} $$IfOdd{17} Yes $$EndIf{} $$IfOdd{Hello} No $$EndIf{} ------------------------------ Yes Yes ------------------------------ ================================================================================ IfExists and IfNotExists, part 1 ------------------------------ $$person = {Fred |.profession Tinker | Tailor} $$IfExists{person} Yes $$EndIf{} $$IfExists{otherPerson} No $$EndIf{} $$IfNotExists{person} No $$EndIf{} $$IfNotExists{otherPerson} Yes $$EndIf{} ------------------------------ Yes Yes ------------------------------ ================================================================================ IfExists and IfNotExists, part 2 ------------------------------ $$person = {Fred |.profession Tinker | Tailor} $$IfExists{person.profession} Yes $$EndIf{} $$IfExists{person.name} No $$EndIf{} $$IfNotExists{person.profession} No $$EndIf{} $$IfNotExists{person.name} Yes $$EndIf{} ------------------------------ Yes Yes ------------------------------ ================================================================================ IfExists and IfNotExists, part 3 ------------------------------ $$person = {Fred |.profession Tinker | Tailor} $$IfExists{person.profession[0]} Yes $$EndIf{} $$IfExists{person.profession[2]} No1 $$EndIf{} $$IfNotExists{person.profession[0]} No2 $$EndIf{} $$IfNotExists{person.profession[2]} Yes $$EndIf{} ------------------------------ Yes Yes ------------------------------ ================================================================================ IfFileExists and IfNotFileExists ------------------------------ $$IfFileExists{scratch.md} Yes $$EndIf{} $$IfFileExists{WeDontHaveThisFile.xyz} No $$EndIf{} $$IfNotFileExists{scratch.md} No $$EndIf{} $$IfNotFileExists{WeDontHaveThisFile.xyz} Yes $$EndIf{} ------------------------------ Yes Yes ------------------------------ ================================================================================ IfJS and IfNotJS ------------------------------ $$IfJS{3 + 7 === 10;} Yes $$EndIf{} $$IfJS{3 + 7 === 12;} No $$EndIf{} $$ten = {10} $$IfJS{3 + 7 === $$ten{};} Yes $$EndIf{} $$IfJS{ const three = 3; const seven = 7; function add(a, b) { return a + b; } 10 === add(three, seven); } Yes $$EndIf{} $$IfNotJS{3 + 7 === 10;} No $$EndIf{} $$IfNotJS{3 + 7 === 12;} Yes $$EndIf{} ------------------------------ Yes Yes Yes Yes ------------------------------ ================================================================================