Programmerare, skeptiker, sekulärhumanist, antirasist.
Författare till bok om C64 och senbliven lantis.
Röstar pirat.
2011-03-11
I can’t hide the fact that I have a childish love for Visual Basic. I think this is worth a few blog posts. Than language and the code editor together works so incredible well for me. The language provides code blocks with keywords for opening and closing, so that you can read out what kind of block is closing. Because of this, the code editor knows about your intentions. Also, the C# editor cannot know if you intend to use curly brackets or not, because they are optional if only one statement will be contained within a block. In C#, to do an iteration with a test in, the iteration and its brackets has to be typed out, and then the test and its brackets has to be typed out.
In Visual Basic, I just write the iteration opening, and when hitting Enter, the editor closes my iteration, does the indentation and places the cursor within, so that I can continue writing my test. Again, I just write the opening part of the test and hit Enter, and the editor closes it, does the indentation and place my cursor within the new block.
for (int a = 0; a <= 10; a++) { if (true) { //Alcatraz style } } For A As Integer = 0 To 10 If True Then 'Quick and nice! End If Next
Also, what } actually means, might depend. Yes, it is a closing block, but what block? In Visual Basic, the block closers are nice and readable. Next is closing For, End While is a closing While, End If is a closing If, and so on.
Categories: Visual Studio 10
Bjud mig på en kopp kaffe (20:-) som tack för bra innehåll!
Leave a Reply