03-18-2016, 01:56 AM
When we start a new project in the IDE we see the following
Every case and default statement is terminated by a colon ":" That colon has been there as long as I remember
Now I've done a lot of switch loops and sometimes I've left off the colon at the end of a case statement by mistake. Those programs ran flawlessly. Also, yab does not throw up an error if they are missing So, why is it there and what is it supposed to do? the help in the IDE shows that you can do this
but that can be done with any set of commands. It is just another way of writing
(BTW shouldn't there be a "break" after "default")
It's a small thing, but every small thing helps make yab a little easier for beginners. If that colon is not actually doing anything, then let's get it out of the templates.
Code:
switch(msg$(everyCommand))
case "_QuitRequested":
case "MainWindow:_QuitRequested":
leavingLoop = true
break
default:
break
end switch
Now I've done a lot of switch loops and sometimes I've left off the colon at the end of a case statement by mistake. Those programs ran flawlessly. Also, yab does not throw up an error if they are missing So, why is it there and what is it supposed to do? the help in the IDE shows that you can do this
Code:
input a
switch(a)
case 1:print "one":break
case 2:print "two":break
default:print "more"
end switch
Code:
input a
switch(a)
case 1
print "one"
break
case 2
print "two"
break
default
print "more"
end switch
It's a small thing, but every small thing helps make yab a little easier for beginners. If that colon is not actually doing anything, then let's get it out of the templates.