Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (117)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Comment Tricks  (Read 789 times)
0 Members and 1 Guest are viewing this topic.
Offline HeroesGraveDev

JGO Kernel


Medals: 254
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Posted 2014-01-20 22:59:48 »

Does any else here do little tricks with java comments in order to save time switching between different behaviours?

For example, to toggle between two lines of code, just add/remove an asterisk:

1  
2  
3  
// The space is there because otherwise the forum syntax highlighting detects it as a javadoc comment.
/* */int i = 0;
//*/int i = 1;


1  
2  
3  
// The space is there because otherwise the forum syntax highlighting detects it as a javadoc comment.
/* /int i = 0;
//*/
int i = 1;


Post your comment tricks here.

Offline Longarmx
« Reply #1 - Posted 2014-01-20 23:37:35 »

I would just normally change
1  
int i = 0;

to
1  
int i = 1;

It only requires changing a zero to a one (or vice versa)! Pointing

Offline Gef
« Reply #2 - Posted 2014-01-20 23:53:09 »

I'm using {Ctrl+/} or {Ctrl+7} in Eclipse to toggle each line separately.
I haven't found a solution to invert the toggle on the two lines together,
from :
1  
2  
     int i = 0;
//   int i = 1;

to :
1  
2  
//   int i = 0;
    int i = 1;

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline HeroesGraveDev

JGO Kernel


Medals: 254
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #3 - Posted 2014-01-21 00:44:55 »

I would just normally change
1  
int i = 0;

to
1  
int i = 1;

It only requires changing a zero to a one (or vice versa)! Pointing

The one I used was just an example.

Actual usage is for longer lines.

Offline Mac70
« Reply #4 - Posted 2014-01-21 11:15:43 »

I think that most of us use "comment tricks" like this. When I need to disable the code for a moment (or test how good is the new version without deleting previous) I use comment/uncomment feature in NetBeans. Smiley

Check out my Devblog! Smiley
Offline Damocles
« Reply #5 - Posted 2014-01-21 11:22:45 »

You can conveniently toogle whole blocks by just adding a slash

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
      /*
         if(wanderChangeCounter<=0)
      {
         wanderChangeCounter=ran.nextInt(7);
         wanderX=ran.nextInt(3)-1;
         wanderY=ran.nextInt(3)-1;
         
      }
       
       //*/


to

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
       //*
        if(wanderChangeCounter<=0)
      {
         wanderChangeCounter=ran.nextInt(7);
         wanderX=ran.nextInt(3)-1;
         wanderY=ran.nextInt(3)-1;
         
      }
       
       //*/

Offline xsvenson
« Reply #6 - Posted 2014-01-21 11:31:57 »

For comments, I just block select ant ctrl+shift+C (on eclipse)(Line comments on whole block)
For me hitting a whole line or block is easier than hitting one character.

“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Offline Oskuro

JGO Knight


Medals: 39
Exp: 6 years


Coding in Style


« Reply #7 - Posted 2014-01-21 14:24:22 »

The only "trick" I use is to try and avoid block comments (/* ... */) in favour of single-line comments (//).... Because then I can use the block comment to remove large chunks of code without a closing comment in between messing things up  Roll Eyes


I'm liking the tricks here, though.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Grunnt (13 views)
2014-09-23 14:38:19

radar3301 (14 views)
2014-09-21 23:33:17

BurntPizza (31 views)
2014-09-21 02:42:18

BurntPizza (22 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (29 views)
2014-09-20 20:14:06

BurntPizza (33 views)
2014-09-19 03:14:18

Dwinin (48 views)
2014-09-12 09:08:26

Norakomi (75 views)
2014-09-10 13:57:51

TehJavaDev (105 views)
2014-09-10 06:39:09
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!