implicit return? [🇷 for BE/BA]

posted by ElMaestro  – Denmark, 2019-04-28 23:16 (2270 d 13:19 ago) – Posting: # 20258
Views: 9,068

Hi Hotzi,

I even go a step further, perhaps only because I am rather dumb.

My functions almost always look like this:
Foo=function(bar)
{
  ##blah blah, conditions and functionality and loops and loads of curly braces here.
  ##whatever happens in loops and conditions it sets a variable called e.g. rslt

  return(rslt) ##I always have a line at the end that looks like this!
}


I do that to make sure that whatever happens with pairs of curly braces I know that my function return is captured at the end. When finding errors and bugs I just need to look at rslt and work backwards. print(rslt) immediately before the return statement is often a very good beginning to that. Not sure if this is smarter (in terms of error finding) but it is my solution to a lot of trouble. Possibly just owing to my own lack of skills.

In C you can also exit with curly braces in the middle of a function. Debugging that sh!t is impossible for me:-).

Pass or fail!
ElMaestro

Complete thread:

UA Flag
Activity
 Admin contact
23,436 posts in 4,932 threads, 1,676 registered users;
58 visitors (0 registered, 58 guests [including 8 identified bots]).
Forum time: 12:36 CEST (Europe/Vienna)

You are rewarding a teacher poorly
if you remain always a pupil.    Friedrich Nietzsche

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5