User Tools

Site Tools


getting_20the_20current_20line_20number

Getting the current line number

by Jon Ripley, Richard Russell, January 2012

The FN_linenumber(!384) function returns the line number of the currently executing line of code as demonstrated below.

  12345 PRINT FN_linenumber(!384)
        END
 
        DEF FN_linenumber(E%)
        LOCAL p%% : p%% = PAGE
        WHILE ?p%% AND p%% + ?p%% < (E% + PAGE - !340) p%% += ?p%% : ENDWHILE
        = (p%%?2*256+p%%?1)

Always pass !384 as the parameter to FN_linenumber, this interpreter internal variable is the pointer to (or within) currently-executing statement.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
getting_20the_20current_20line_20number.txt · Last modified: 2024/01/05 00:22 by 127.0.0.1