Let's switch out that colon!
#1
When we start a new project in the IDE we see the following
Code:
        switch(msg$(everyCommand))
            case "_QuitRequested":
            case "MainWindow:_QuitRequested":
                leavingLoop = true
                break
            default:
                break
        end switch
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
Code:
input a
switch(a)
    case 1:print "one":break
    case 2:print "two":break
    default:print "more"
end switch
but that can be done with any set of commands. It is just another way of writing
Code:
input a
switch(a)
    case 1
        print "one"
        break
    case 2
        print "two"
        break
    default
        print "more"
end switch
(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.
Reply
#2
OK, I never noticed it.

All I need to do is modify the template file.
Reply
#3
Done! https://github.com/bbjimmy/YAB/commit/57...52d8bcb8ab
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)
Free Web Hosting