Hikaroshi's Profile User Rating: -----

Reputation: 8 Worker
Group:
Members
Active Posts:
42 (0.02 per day)
Joined:
26-April 09
Profile Views:
2,629
Last Active:
User is offline Nov 14 2013 09:29 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0

Latest Visitors

Icon   Hikaroshi has not set their status

Posts I've Made

  1. In Topic: Undefined variable error with a method

    Posted 6 Sep 2013

    To add on to that explanation above, with the code you have posted, your code runs line by line. Once it reaches that function call, it doesn't recognize the function because it did not reach that line where the function is created, which happens after you try to call it. Like this link. If you step through it, you realize what is going on. It would technically work if the call happened after the program had reached that line and created a pointer to location of the function definition, like in this example.

    If you have everything in a function, the program will run line by line, but in a different sense. It will go from top to bottom and point to where each function is defined, but will only execute (explore the contents of the function) the function if it is called. In the case of this last example if newFunction() was not called on the last line of the program, the program would just contain pointers to the functions but would not execute anything because none of the functions were called. Then from there, newFunction() calls the other function on line 7.

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

Comments

Hikaroshi has no profile comments yet. Why not say hello?