Jump to content

small code challenge


yomama

Recommended Posts

1 minute ago, yomama said:

c# aa swift or obj c using man. But ikada key value rendu strings and you are trying to assign int to string. 

I don't know obj c or swift but neenu akkada em chesthunna ante I am trying to send the item key to a seperate function which calculates the continent based on the logic and returns an int and I am using that integer in the switch case. 

 int continent = GetContinentIdFromKey(item.Key);

this above function here takes in a string (item key in our case) and returns an integer like 1 for europe and 2 for asia  and finally using that integer in switch add item to individual array. 

 

Link to comment
Share on other sites

42 minutes ago, Suhaas said:

Sure bhayya. I usually a separate the logic for unit testing or whatever reasons. 

PS: I am not an expert. Just trying. 

thats the way it should be..granularity, maintainability..simple and precise code  

Link to comment
Share on other sites

17 minutes ago, Suhaas said:

I don't know obj c or swift but neenu akkada em chesthunna ante I am trying to send the item key to a seperate function which calculates the continent based on the logic and returns an int and I am using that integer in the switch case. 


 int continent = GetContinentIdFromKey(item.Key);

this above function here takes in a string (item key in our case) and returns an integer like 1 for europe and 2 for asia  and finally using that integer in switch add item to individual array. 

 

yeah i understood that. using that method to get a int and switching it. 

Link to comment
Share on other sites

1 hour ago, yomama said:

@loveindia Good job man. 

loveindia.png

nenu appudey anna man... no IDE using windows laptop in office so couldn't test in swift.. atleast should have used IBM swift before I pasted it... swift lo append undi... intellisense ki alavaatu padi marchipoya man... but max raasa correct gaaney... :D way to go man...

Link to comment
Share on other sites

1 hour ago, loveindia said:

nenu appudey anna man... no IDE using windows laptop in office so couldn't test in swift.. atleast should have used IBM swift before I pasted it... swift lo append undi... intellisense ki alavaatu padi marchipoya man... but max raasa correct gaaney... :D way to go man...

yeah ufcourse man you are correct. Nen just simple syntax errors fix chesa anthe ga. i just like xcode ide , it supports everything i guess. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...