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!

2replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
    • Mike
    • ninox.1
    • 1 mth ago
    • Reported - view

    These videos are very helpful!

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

    Well done!

    Like 1
  • Thank you Maja.

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

    Like
Like3 Follow
  • 3 Likes
  • 1 mth agoLast active
  • 2Replies
  • 162Views
  • 6 Following