aspose file tools*
The moose likes Applets and the fly likes Switch or Else If Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Switch or Else If" Watch "Switch or Else If" New topic
Author

Switch or Else If

Imogen Handy
Greenhorn

Joined: May 03, 2013
Posts: 1
My project requires me to create a game which produces random and golden ratio rectangles when the user presses one button, i have attempted to use a swich statement here so when the user clicks the programme will either draw a rectangle or a golden ratio rectange but when the button is clicked it only draws the 1st case is there anyway to get it to alternate between cases? Or should i be using an if else statement or even something else

Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

Imogen,
Welcome to CodeRanch! We used "code" instead of "highlight" here for blocks of code. I've edited your post to fix that so the code is easier to read.

I would use the if/else there since there are only two cases. It is a little clearer that way.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Switch or Else If