Help on when loop

This is my code for the 99 bottles of beer on the wall song... I got the idea from a book and said, hey neat, I should try that:
class beerSong{
     public static void main(String[] args){
          int beerNum = 99;
          when(beerNum > 1); {
               System.out.println(+beerNum+" bottles of beer on the wall, "+beerNum+" bottles of beer,");
               beerNum = beerNum - 1;
               System.out.println(" take one down, pass it around, "+beerNum+" bottles of beer on the wall!");
} but when I try to compile it, I get error messages. I have tried and failed many a time, and now I ask you guys: whats up with the when loop?
Thanks,
Jake

Notice that FOR can go backwards, lol, so dont use WHILE.
public class BeerSong{
public static void main(String[] args){
     new BeerSong();
public BeerSong(){
     for(int i = 100; i >= 0; i--){
     System.out.println("\n" + (i) + " Bottles of Beer on the Wall, " + (i) + " Bottles of Beer");
     System.out.println("Take One Down and Pass It Around " + (i) + " Bottles of Beer on the Wall");
}

Similar Messages

  • Strange behaviour when looping MIDI

    Hi,
    I encounter a strange behaviour when looping MIDI:
    1) Created a new MIDI track
    2) Recorded two bars of MIDI drum track (e.g. just a bass drum with Indie Kit Live) via my EDIROL and MIDI piano.
    3) played it back: works
    4) checked the "Loop" box
    5) played it back: after the 4th repeat the drum pattern changes. either it misses two beats or does not play the bass drum but the hihat for two beats.
    I'm using Logic Pro 8.
    Can someone tell me what's going on and how this can be resolved?
    Also on some occasions I have the following behaviour:
    1) Recorded MIDI in loop mode (a few takes).
    2) Played it back: Did not produce any sound.
    3) Tried a different take from the take folder: Did not produce any sound.
    4) Tried to mute/unmute track and different take from the folder: Did not produce any sound.
    5) Tried to MIDI mute/unmute different takes from the folder: Did not produce any sound.
    6) Closed/reopened project and MIDI unmuted the take: Played fine.
    Thanks a lot for some help with those two problems.
    Alex

    Did not happen again in Logic 9 and after starting a fresh project.

  • CVI XML Functions Execution Times Increase When Looped

    I have written multiple functions using CVI that read XML files. I have confirmed in the Resource Tracking utility that i have cleaned up all of my lists, elements, documents, etc. I have found that when I loop any of the functions I have created, the execution times increase. The increase is small but it is noticable and does effect my execution.
    Are there any other sources of memory that I need to deallocate? It seems that there is a memory leak somewhere but I am unable to see where this increase is located.
    I am currently running LabWIndows/CVI 2009 on Windows 2008 Server. I have looped my functions using TestStand 4.2.1. Any help would be appreciated!
    Thanks in advance,
    Kyle
    Solved!
    Go to Solution.

    HI Daniel,
    Thanks for the quick response.
    It is indeed slow down in execution speed when we loop. When looped, the XML reader is overwriting variables, not adding to an array. Our application is structured differently than my test case. We run a CVI function from TestStand that contains a series of commands, which contains the XML reading. The XML looping is really done in CVI. I used TestStand in my test case just to get execution times. Our psuedocode for the CVI function is as followed:
    For loop (looping over values, like amplitude or frequency)
    Reading the XML
    Applying the data from the XML to set up some instrument(s)
    Do something...
    End loop
    I can confirm that the instrument set up is not the cause of the slow down. We have written the same XML reading in C# and applied the values to the instrument setup and do not experience the slow down.
    I tested with On-The-Fly Reporting enabled and the execution time continued to slow down.
    I hope that answers all of your questions!
    Thanks,
    Kyle

  • I got new hard driver for my MacBook I don't have the cd but I do have flash drive that has the software I need help because when I turn on my laptop it shows me a file with question mark how can I install the software from the flash driver?

    I got new hard driver for my MacBook I don't have the cd but I do have flash drive that has the software I need help because when I turn on my laptop it shows me a file with question mark how can I install the software from the flash driver?

    Hold down the Option key while you boot your Mac. Then, it should show you a selection of devices. Click your flash drive and it will boot from that.

  • HT4623 please help me when update my i phone 3G i finish update but face problem , appear me msg There is no SIM card installed in the iPhone You ar attempting to activate. Please disconnect

    please help me < when update my i phone 3G < i finish update but face problem , appear me msg There is no SIM card installed in the iPhone You ar attempting to activate. Please disconnect

    Sounds like your phone was hacked to use with your carrier.  Updating it has relocked the phone to it's original carrier.  You will not get the phone working again without a SIM from the original carrier.

  • I need help! when I am importing my NEF files from my D3300 camera into lightroom 5 and try to use the "copy as DNG" button I always get an error message saying that "saying the file is not recognized by the raw format support"

    I need help! when I am importing my NEF Raw files from my D3300 camera into lightroom 5 and try to use the "copy as DNG" button I always get an error message saying that "saying the file is not recognized by the raw format support". The whole purpose of that button is so that the file can be recognized... How can I make the "copy as DNG" button work as it is supposed too?? Thank you

    Thank you for responding. So I essentially will never be able to use that button in lightroom 5? do I need to get LR 6? Will there ever be an update for LR 5 that will enable me to use it?
    Does DNG Converter work within LR or do I have to upload pictures to my computer and then make a second copy in DNG format. and then go into LR and use them?
    Thank you @dj_paige

  • Help! When I try to purchase a song from iTunes and have agreed to the terms and conditions, it then tells me that my session has timed out... but I've only been trying for a few minutes. I can't buy songs if it keeps doing this!

    Help! When I try to purchase a song from iTunes and have agreed to the terms and conditions, it then tells me that my session has timed out... but I've only been trying for a few minutes. I can't buy songs if it keeps doing this! Does anyone know why it's doing this and how to fix it? Thanks!

    Hi mterry1723, one solution that might be worth trying is this:
    - Close iTunes, if it's open
    - Open Safari and got to 'Preferences'
    - Select 'Security' on the top
    - Untick all the security options in the menu
    - Click the 'Show Cookies' button and look for all the 'apple' entries in the left-hand column.
    - Highlight them (select them collectively) and press 'Remove'
    - Now open iTunes and buy the song as usual.
    - You may be asked to do the same security process as before, so do as asked.
    - Hopefully, the security check will now have accepted your answers and start downloading the song as normal.
    Remember to re-tick all the required security options you had just un-ticked in Safari preferences. You don't need to bother about opening the cookies again.
    I hope this has worked for you and my profoundest apologies if it has not. Worth a go, though!
    I did see this thread: https://discussions.apple.com/message/18259935#18259935 which may be of more help, mainly the last entry by 'c2boyd'
    Message was edited by: Bongomal

  • Help! When i connect my "iomega" External hard drive to my mac it does not show in devices or on the desktop, how can i access my hard drive?

    Help! When i connect my "iomega" External hard drive to my mac it does not show in devices or on the desktop, how can i access my hard drive?

    what format your iomega HD is it NTFS , if NTFS try download   http://www.apple.com/downloads/macosx/system_disk_utilities/ntfs3g.html

  • Can anyone help me - when I open itunes for some reason TV shows does not appear anymore?

    Can anyone help me - when I open itunes for some reason TV shows no longer appears?

    Go to iTunes prefs>General - make sure the box is ticked for TV Shows.
    MJ

  • I need help. When I open my "page" all my documents were gone. I need those things.

    I need help. When I open my "page" all my documents were gone. I need those things.

    I meant flickering means...when i open combobox and click focus is going out of air window as though combobox is in some another window. once click press mouse down...focus is in combo box but window loses focus and once releases mouse ..window back to focus.  Kinda annoying effect when u try to click on combo box and select.
    Tested with html scout sample app and load any webpage with combobox , window loses focus.
    But any combobox made using EXT it do not flicker because ext handles focus event correctly.
    My windows has set of combo box and user always select different value from combo box if keep losing focus and coming back its annoying as hell.

  • With FireFox as my default browser, I create a shortcut on the desktop as per instructions in 'help' but when I click on the shortcut it opens in a browser which is not even running.

    With FireFox as my default browser, I create a shortcut on the desktop as per instructions in 'help' but when I click on the shortcut it opens in a browser which is not even running.

    -
    Make absolutely certain that FireFox is designated as your default browser.
    Do this: Tools / Options / Advanced / Check Now / correct the setting
    OR right click on any shortcut icon / Open With / Choose Default Program / select desired Browser / check Always... box / OK
    ----SOLVED-----------
    -

  • Update-Help error when console application is run in remote machine via PS remoting

    Hello,
    When I execute a particular console application in a remote machine via PS remoting, I get an error related to update-help. When I execute it directly on the remote machine, it works...
    My code:
    $credential = Get-Credential -Credential "DomainName\AccountName"
    $session = New-PSSession -ComputerName "MachineName" -Authentication Credssp -Credential $credential;
    Invoke-Command -session $session -ScriptBlock {
    try{
    cd <network share location>
    .\theConsoleApp.exe | Out-File C:\console-output.txt
    $error | Out-File C:\console-error-output.txt
    $exitCode
    } catch {
    throw $error
    Error seen in the console:
    NetNat, PcsvDevice, PSDesiredStateConfiguration, SoftwareInventoryLogging, StartScreen, TLS, WindowsSearch' with UI culture(s) {en-US} : Unable to retrieve the HelpInfo XML file for
    UI culture en-US. Make sure the HelpInfoUri property in the module manifest is valid or check your network connection and then try the command again.
    $error variable from above:
    Errored out (exit code 1603) with error message: ErrorId 10010: Xpatch threw an unexpected exception: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
    I’ve tried
    two different user accounts
    multiple file share locations
    different OSs
    different target servers
    but have not determined the cause of the error.
    I would appreciate any help on this.
    -Rohan.

    Clearly the remote EXE cannot run in that context.  YOU should not run that program remotely.
    I suspect there is also information you are not giving to us.
    ¯\_(ツ)_/¯

  • Please help. When exporting a 720p video using Quicktime Conversion in FCP it saves some extra temporary files to my computer. The file is called ICMMultiPassStorage. This file gets so large that eventually the program and exporting process crashes.

    Please help. When exporting a 720p video using Quicktime Conversion in FCP it saves some extra temporary files to my computer. The temporary file it saves is called ICMMultiPassStorage. This file gets so large that eventually the program and exporting process crashes. I have been able to locate the file using GrandPerspective and close out of FCP to delete it. But when I try exporting the movie again it creates the ICMMultiPassStorage file again. I have made sure my scratch disks are set to my external hard drive so I know that isn't the issue. How do I fix this problem so these temporary files are not being stored on my internal hard drive instead of my external?Thanks!

    Try exporting the timeline "using current settings" via Make QuickTime Movie, then submit that clip to Compressor for the transcode. This should be faster and less painful.

  • Hi i need help please . when i want to buy app from store ask me the security question but i forgot the answer  so i need to the link to rest answer of security question

    hi
    i need help please . when i want to buy app from store ask me the security question
    but i forgot the answer
    so i need to the link to rest answer of security question

    The Best Alternatives for Security Questions and Rescue Mail
        a. Send Apple an email request at: Apple - Support - iTunes Store - Contact Us.
        b. Call Apple Support in your country: Customer Service: Contact Apple support.
        c. Rescue email address and how to reset Apple ID security questions.

  • My phone suddly switched off and now its not switching on can any one help me when it swithch off my phone battery was full.

    my phone suddly switched off and now its not switching on can any one help me when it swithch off my phone battery was full.

    Which apps do you open acouse iphone switched off? You can try to reset iPhone.

Maybe you are looking for

  • Thumbnail previews in Windows Explorer (Windows 7 64bit)

    Is there a way to enable thumbnail previews under Windows Explorer for Acrobat X Pro? I just installed the trial and these are missing. I know there was a bug in Acrobat 9 which required a third party hack to fix. I had hoped by now this would work c

  • Update image in JavaFX Applet with JavaScript

    Need help! Is'it posible to reload/update/change image in JavaFX Appet Image object via javascript? Thanx.

  • HFM Client (11.1.2.0.0) Installation Error Windows 7

    Recieved error after running the installTool.cmd in the Foundation11121 folder. It said that it could not find Z:\Foundation11121\\jre\winAMD64\1.6.0\bin\java The "\\" after Foundation11121 is what the error says, not a typo. Client install works on

  • PSE 9 - Unable to change fonts

    I am unable to change font in pse9 Subject edited by: Ivan David

  • Can't believe how unprofessional this company is!

    We bought a $4000 4k tv. It broke after 2 weeks of use!  That was 2 weeks ago!! We have called customer service multiple times. Can't talk to a supervisor. Can't talk to customer relations. Can't get any phone numbers. We've been hung up on twice. Th