Author Topic: Jump/gosub and return  (Read 4471 times)

Technomancer

  • Jr. Member
  • **
  • Posts: 98
  • I have a bad feeling about this...
Jump/gosub and return
« on: August 20, 2016, 08:37:30 PM »
a RETURN from a JUMP (or a GOSUB-style) instruction would be sweet. ;)


EDIT by Pfeil: Can be done using the "Execute Another Command" action with the "Wait until this command completes before continuing" checked
« Last Edit: April 18, 2020, 07:05:42 AM by Pfeil »

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Jump/gosub and return
« Reply #1 on: August 21, 2016, 10:37:52 PM »
This is actually a good idea, and probably not hard to implement.  The workaround for now would just put a marker after your jump and return to that marker:

Do something
Jump to, 'XYZ'
Marker ABC
Email Whitehouse
Format hard drive
Exit Command

Some stuff
Write 'Hello World' to log

Marker XYZ
Do something here
Jump to ABC


It will really only save one line tho.  'Marker ABC' would be eliminated and 'Jump to ABC' would be, 'Jump Return'.

Technomancer

  • Jr. Member
  • **
  • Posts: 98
  • I have a bad feeling about this...
Re: Jump/gosub and return
« Reply #2 on: August 22, 2016, 09:04:21 AM »
Gary, thanx for the useful suggestion. I must say, your response time is extraordinary.

I actually have done that on a couple of instances.  And honestly, I'm at work and I can't quite remember why I thought to myself "Man I wish I could return from this JUMP and continue the instruction set."

However, last night I tried something that I hadn't tried before because I didn't think it would work:

I had a 10-15 line instruction set that was identical in about 6-8 commands, so I tried setting up that instruction set as a different command and just executing it from "Run another command".  I thought that VA would send the current command to the new command, but that it would just concurrently keep running the rest of the original command. However, in the instances I tried it, it went to the "SUBROUTINE", executed it and returned before continuing.  I guess, effectively, this is what I was looking for. I just don't know if the instructions would execute quicker if they were inside the same command.

Anywaaaaay...I freakin' love VA. I'm recommending it to all my friends.  They kinda freak out when they see it in action and all the possible applications of it.

Keep up the good work.  :D