3

Switch Case statement in Ninox

Another great structure in Ninox that can help you in the automatization of your processes is a Switch Case statement. Simple syntax, fewer lines of code, and faster result in your app. 

Please check the video with samples, and read below about the keywords & syntax:

🔑 KEYWORDS:

switch ... do - is an opening word

case -  is used to select one of many code blocks for execution

default -  used to specify the code executed when the expression does not match any test case (optional)

end - obligatory

💡 SYNTAX:

switch ChoiceField do
case 1:"Monday"
case 2:"Tuesday"
case 3:"Saturday"
case 4:"Sunday"
default:"No choice has been made!"
end

📣 There are some things to be remembered while using switch case in Ninox:

  • Two cases cannot have the same value
  • The data type of variable in the switch needs to be the same as all test cases' values
  • The test case values need not be in order (ascending or descending)
  • Nesting is allowed, but it makes the program more complex

📌 Fewer lines of code are always better!

Have fun with Ninox!

2 replies

null
    • ninox.1
    • 2 yrs ago
    • Reported - view

    These videos are very helpful!

    I hope you put these videos on the main help site for future reference.

    Well done!

    • Ninox developper
    • Jacques_TUR
    • 2 yrs ago
    • Reported - view

    Thank you Maja.

    In addition, here is an advanced use of the Switch statement : https://forum.ninox.com/t/p8hdmy1

Content aside

  • 3 Likes
  • 2 yrs agoLast active
  • 2Replies
  • 2944Views
  • 6 Following