This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Utterly lost and frightened, Exiting a while loop.

Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me start off by saying this is a work in progress, I will be adding arrays at some point, and tiding up the whole thing in general, the reason it looks so messy right now is I've been trying 100's of methods trying to get the game to jump to the dealers turn after the while loop is broken. These are my first baby steps into java so please don't critique too harshly. I'm still not 100% on how to make an array function correctly. Alot of work to do still.

If you can ignore the garbage at the start and tell me why the break; command isn't performing a break, or alternately how to get the while loop to jump to a section of code that will be the dealers turn.

I seen a lot of video tutorials, and read a lot of "blackjack" codes, it's a popular program to cut your teeth on apparently !!

Anyways... Thanks for the feedback, and I am trying to learn this stuff, but Rome wasn't build in a day !

Posts: 1845
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Code looks valid to me.

What are you trying to "break" out of doing?
Where do you think the code for the dealers turn should go?
Right now you "break" when you enter an invalid value. Is that correct?

Posts: 69882
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should break out of that main method. A main method should contain one statement. The more you write in one method the more you are going to tie yourself in knots.

You have got a game which you are not designing. What sort of design do you have for it? You appear to be adding bits here and there. You will never get that to work. Start by dividing it into parts. The smaller the parts the easier they will be to handle. Also create classes for the players and the game.
    Bookmark Topic Watch Topic
  • New Topic