What is the proper grammar for entering a return constant line break? I am trying to enter variables into a field. I want one line followed by another, therefore it seems return is what I am looking for. I am trying to illustrate the greatest common divisor algorithm. This is what I have so far:
put 673 into m
put 12 into n
--673 and 12 could be any numbers
put m & comma & n into field "Field"
--I want 673,12 to be displayed so the users know what numbers we are finding the greatest common divisor of
put return after item 2 of field "Field"
--so this is the part that is wrong. Whatever I put next just replaces the 673,12 instead of being on the next line.
--then I want to do m mod n to find the remainder and proceed with the algorithm
I hope I explained my issue correctly. Thanks a bunch.
script edit return constant
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: script edit return constant
Hi,
So, where's the syntax that "puts next"? In the syntax you posted, I see no mistakes.
Kind regards,
Mark
So, where's the syntax that "puts next"? In the syntax you posted, I see no mistakes.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: script edit return constant
I think what you want to do is to now
After will put it at the end of the field and create a new line, then you can display your divisor on the next line and continue on that way.
Hope I'm understanding correctly,
Kelly
Code: Select all
put return AFTER field 1
...
put divisor & return after field 1
Hope I'm understanding correctly,
Kelly
Re: script edit return constant
If you start with an empty field
put empty into field "myfield"
Then want to cycle through a bunch of numbers and build up a sequence of lines use the "after" form of put as mentioned above.
put m & comma & n & return after field "myField"
This way it will append whatever you are 'put'ting AFTER the end of the field.
Then when done putting all your lines in you'll want to "delete the last char of field "myField" to get rid of the dangling return.
Another method would be to ignore the field while processing is done and build your list of lines in a variable.
put m & comma & n & return into tMyTempVariable
When done processing all your numbers,
delete the last char of tMyTempVariable
put tMyTempVariable into field "myField" -- since we're wanting to put the whole contents of the variable into the field intact, use into rather than after
If there will be lots of lines and processing to be done, using a temp variable to hold the work in progress will be faster than working directly with the field.
put empty into field "myfield"
Then want to cycle through a bunch of numbers and build up a sequence of lines use the "after" form of put as mentioned above.
put m & comma & n & return after field "myField"
This way it will append whatever you are 'put'ting AFTER the end of the field.
Then when done putting all your lines in you'll want to "delete the last char of field "myField" to get rid of the dangling return.
Another method would be to ignore the field while processing is done and build your list of lines in a variable.
put m & comma & n & return into tMyTempVariable
When done processing all your numbers,
delete the last char of tMyTempVariable
put tMyTempVariable into field "myField" -- since we're wanting to put the whole contents of the variable into the field intact, use into rather than after
If there will be lots of lines and processing to be done, using a temp variable to hold the work in progress will be faster than working directly with the field.
-
- Posts: 2
- Joined: Mon Jan 16, 2012 9:20 am
Re: script edit return constant
Many thanks for the insight!