Re: [swift-users] Swift BMI

2015-12-15 Thread Gage Morgan via swift-users
Understood. Sent from Outlook Mobile On Tue, Dec 15, 2015 at 2:19 PM -0800, "Kelly Keenan" wrote: Hi Gage, I’d like to invite you to read through our Code of Conduct for the Swift community. While something may seem like a joke to you, it

Re: [swift-users] Swift BMI

2015-12-15 Thread Kelly Keenan via swift-users
Hi Gage, I’d like to invite you to read through our Code of Conduct for the Swift community. While something may seem like a joke to you, it is not always the case for everyone. Please be mindful of this in the code that you write as well as the c

Re: [swift-users] Swift BMI

2015-12-15 Thread Gage Morgan via swift-users
Also, another goal of doing it was to see if I could using a class. Which worked. I apologize for the delay, apparently as a Junior our HS does not trust us with EMAIL which of all things kids probably don't use for messaging. Sent from Outlook Mobile On Tue, Dec 15, 2015 at 12:35 PM -0800,

Re: [swift-users] Swift BMI

2015-12-15 Thread Gage Morgan via swift-users
I understand that mine is a bit more complicated than it needs to be. It works, that's good enough for me. It gives proper values. I knew SOMEONE would have an issue with the "breaking machine," and I realized it could not be reached before typing it. I put it in there as a joke, nothing more (I

Re: [swift-users] Swift BMI

2015-12-15 Thread Erica Sadun via swift-users
And, of course, this is a perfect opportunity to use Swift tuple returns and eliminate the side-effect of printing the numeric value: http://swiftstub.com/176972405 -- E, whose kids have a snow day this morning in case you can't tell > On Dec 15, 2015, at 7:20 AM, Erica Sadun wrote: > > In f

Re: [swift-users] Swift BMI

2015-12-15 Thread Erica Sadun via swift-users
In fact, there's no really good reason to use any construct, whether struct, class, or enum, for this at all since the BMI isn't a "thing" per se. A global function might be a better fit. http://swiftstub.com/443052056 -- E > On Dec 15, 2015, at 7:10 AM, Eimantas Vaiciunas via swift-users >

Re: [swift-users] Swift BMI

2015-12-15 Thread Eimantas Vaiciunas via swift-users
I exchanged a class to an enum since the BMI values are a finite set. This eliminates a need for valid value check since the switch that is used to initialise the enum value is exhaustive. http://swiftstub.com/242291010/ On Tue, Dec 15, 2015 at 3:30 PM, Erica Sadun via swift-users < swift-users@s

Re: [swift-users] Swift BMI

2015-12-15 Thread Erica Sadun via swift-users
Leaving aside typos, any discussion about the merits of BMI, and the intemperate language in the code, you do a few things that could be improved upon language-wise. Of these, the most egregious is the final "break the machine" else statement that can never be reached. The following example doe

Re: [swift-users] Swift BMI

2015-12-14 Thread Gage Morgan via swift-users
And a more polished version:https://gist.github.com/MGageMorgan/c2166174be878e9cea78 Sent from Outlook Mobile On Mon, Dec 14, 2015 at 7:20 PM -0800, "Gage Morgan via swift-users" wrote: For most languages I try out, my own version of "Hello World!" is a BMI calculator. Swift has passe

[swift-users] Swift BMI

2015-12-14 Thread Gage Morgan via swift-users
For most languages I try out, my own version of "Hello World!" is a BMI calculator. Swift has passed, I encourage you to try it out.  There are two methods called towards the end of file:1) bmi.pounds(weight, height) - Replace numbers inside with your own if you want to test out in US Customary