
-----------------------------------
SucreTeen123
Mon Apr 09, 2012 6:30 pm

Procedure Subprogram Help 2
-----------------------------------
Anyways I am horrible at Turing and I really need some help! So whoever is out there help!!!!!!! 

Question: Write and test a procedure subprogram called swap for swapping the values between two string variables given as parameters of the procedure.


Thank you!

-----------------------------------
Raknarg
Tue Apr 10, 2012 8:47 am

RE:Procedure Subprogram Help 2
-----------------------------------
first off, you'll need something like this:


proc swap (var a, b : string)

end swap


Now what you've done is created parameters that will change the variable you used. for instance:

proc add_5 (var x : int)
     x += 5
end add_5

var num : int

add_5 (num)


Now if you put num, it will be five. If you define your parameter as a variable, it makes it mutible, so it will change it on the outside. Without var, it turns them into constants within that procedure.

So now that you know this, you have a simple task. Find a way to assign a and b's values to eachother
