Discussion Locked

Visual Basic

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

ds = s / 10

i = 0

Do Until yg = ym

yg = (weightp * (depth / 2) + weightl * (depth + s + (ds * i))) / (weightp + weightl)

i = i + 1

Exit Do

Loop

cheight = s + (ds * i)

what i want the code to do is too loop over and over again increasing the value of i every single time by 1 until ym = yg. i want it to then take that value of i and calculate cheight using that value. any ideas anyone? i dont know anything about programming and really am stuck

3 replies

by john.a.wills

The code looks right to me, except that there is no provision for yg never reaching ym. Perhaps you should write yg >= ym in the guard - or perhaps an infinite loop is legitimate for you.

This discussion is closed to new replies.