Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on placement of ;

 
Ashish Anant Patil
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what does " ;" in middle of program or loop mean?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15214
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's an empty statement, and does nothing.

Can you give a specific code example?
 
Ashish Anant Patil
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for(int i=1;i<4;i++)
;
//more code...
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15214
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a loop that lets i increment from 1 to 3, but does nothing in each iteration of the loop. Nobody would write something like that in real code, if they know what they are doing.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic