Fast comment-swapping of code snippets |
|
axsoft
版主 發表:681 回覆:1056 積分:969 註冊:2002-03-13 發送簡訊給我 |
Fast comment-swapping of code snippets 資料來源: www.delphi3000.com Sometimes when testing or debugging, you need to be able to change code on one line between two different statements. You can easily comment and decomment the two choices using 'curly-brackets' {}, but then you have to place your cursor twice to change. Sometimes when testing or debugging, you need to be able to change code on one line between two different statements. You can easily comment and decomment the two choices using 'curly-brackets' {}, but then you have to place your cursor twice to change, and delete as well as add characters. This trick is so simple its almost silly (and is probably known to many), but comes in very handy sometimes: Just put both statements on one line, with two slashes and a close-curly-bracket, like so: DoCodeStatementOne; //} DoCodeStatementTheOther; As shown, "DoCodeStatementOne" will be used when you compile -- everything after the slashes is seen as a comment. Then, to quickly change to "DoCodeStatementTheOther" for a modified test compile, you need only put an open-curly-bracket to the left of the line, like so: { DoCodeStatementOne; //} DoCodeStatementTheOther; And this one character both comments out the first statement and un-comments the second! 網路志工聯盟----Visita網站http://www.vista.org.tw
---[ 發問前請先找找舊文章 ]---
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |