x RadicalAura x's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Members
Active Posts:
29 (0.04 per day)
Joined:
01-December 12
Profile Views:
477
Last Active:
User is offline Apr 12 2013 05:32 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   x RadicalAura x has not set their status

Posts I've Made

  1. In Topic: Do/While Pretest Loop

    Posted 11 Apr 2013

    Think I got it finalized, guys. Thanks to all of you who have responded in attempt to help out. Like I said, I just started learning loops/arrays this week so it's kind of uncharted territory for me up until now. This was definitely a good introduction to them though. Thanks again.
  2. In Topic: Do/While Pretest Loop

    Posted 11 Apr 2013

    View Postlar3ry, on 11 April 2013 - 10:06 PM, said:

    View Postx RadicalAura x, on 11 April 2013 - 10:46 PM, said:

    Like so?:

    OK, let's step through your code, one line at a time.

    Dim grams as Decimal = 100
      'OK, there's a nice initial value to start with
    
    Dim years as Integer = 28
      'and another value, which is actually a unit of half-life
    
    Do While grams >= 1 and years <=56
        'OK, that's the start of a loop that will run until grams is equal to or less than 1,
        'AND years is less than 56
    
    For i as Integer = 0 To years Step 28
        'OK, first time through the For loop, i = 0
        ' second time through, i = 28
    	grams = 50
        ' first time though the For loop, grams = 50
        'second time through, grams = 50
    Loop
        'oops, the first part of the Do loop ends here, before the end of the For loop.
        'definitelt not going to work.
    Next
    
    

    Even if you had the For loop entirely withn the Do loop, you are going to loop forever, because grams will always be set to 50, twice per Do loop, and years will always be 28.

    Again, THINK, man, THINK!

    Lar3ry, I adjusted it to grams *= 50, I think that's right.

    View Post_HAWK_, on 11 April 2013 - 10:06 PM, said:

    If it's part of your assignment then it is fine.

    Thanks so much for your help!
  3. In Topic: Do/While Pretest Loop

    Posted 11 Apr 2013

    View Post_HAWK_, on 11 April 2013 - 10:00 PM, said:

    Don't think you need to Do While part. You may just want to check the year variable with an If statement surrounding the loop - to check size.

    If years >= {some number} Then
      'for loop
    End If
    

    Doesn't a pretest loop have to have the "Do While?" I might have misunderstood.
  4. In Topic: Do/While Pretest Loop

    Posted 11 Apr 2013

    View Post_HAWK_, on 11 April 2013 - 09:50 PM, said:

    Would it not be:

    grams *= 0.5
    


    Which says grams = grams * 50%

    Since it decay 50%?

    Dim grams as Decimal = 100
    Dim years as Integer = 28
    Do While grams >= 1 and years <=56
    For i as Integer = 0 To years Step 28
    	grams *= 0.5
    Loop
    Next
    
    

    Better? That makes sense. Sorry, I forgot that I shouldn't define the variable within the loop.
  5. In Topic: Do/While Pretest Loop

    Posted 11 Apr 2013

    Like so?:
    Dim grams as Decimal = 100
    Dim years as Integer = 28
    Do While grams >= 1 and years <=56
    For i as Integer = 0 To years Step 28
    	grams = 50
    Loop
    Next
    
    

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

x RadicalAura x hasn't added any friends yet.

Comments

x RadicalAura x has no profile comments yet. Why not say hello?