T
15

Built my first proper function today instead of copying code

I was stuck between using a loop OR writing a function for my little calculator project. My friend told me functions are 'cleaner but slower to set up.' I went with the function anyway after 20 minutes of trial and error. It worked on the first try and I saved like 15 lines of repeated code. Did anyone else find functions way less scary after you just forced yourself to use one?
2 comments

Log in to join the discussion

Log In
2 Comments
reese551
reese5513d ago
Whoa hold up, wait a minute! You just said you built a function and it worked on the FIRST TRY? That's wild, man. First try is basically unheard of for me - I always get hit with a syntax error or some weird indentation thing that takes an hour to track down. Good on you for making the jump though, functions really do clean everything up once you get past that mental block.
6
grant569
grant5694d ago
Yeah I was exactly the same way man. That first time you write your own function and it actually runs feels like a total cheat code. Definitely saves a ton of headache down the road once you get the hang of it.
4