Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
JOSS
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Commands === ====Set==== The {{code|Set}} command assigns the results of an expression to the specified variable. Equivalent to BASIC's {{code|LET}}. 01.30 Set p=3.14156. 01.60 Set i=l*(r/100)*t. {{code|Set}} was optional when used in direct mode, where one could type {{code|x{{=}}5.}} without the Set command. This was not allowed in indirect mode, in contrast to BASIC.{{sfn|Gimble|1967|p=68}} ====Let==== {{code|Let}} was used to define user-defined functions.{{sfn|Gimble|1967|p=74-75}} Equivalent to BASIC's {{code|DEF FN}}.{{sfn|Gimble|1967|p=65}} Let t(x)=sin(x)/cos(x). Set j=t(1.1). Type j. {{code|Let}} can also be used to set the value of a variable using a formula consisting of a constant: Let x=5. From that point, it can be used identically to one created using {{code|Set}}. There is a subtle difference, however, when this X is referenced in code, the value will be calculated by evaluating the right-hand side. A {{code|Set}} is only evaluated once, so it is much faster.{{sfn|Gimble|1967|p=45}} The system generally suggested using {{code|Let}} only in direct mode, saving them out for use in a program by inserting them at the top or bottom of the file. This avoided the {{code|Let}} being called multiple times during execution, as it would only be called once during the loading process.{{sfn|Gimble|1967|p=63}} ====Demand==== The {{code|Demand}} takes a list of variables and stores the user input in variables. The optional {{code|as}} qualifier added a custom prompt. Equivalent to BASIC's {{code|INPUT}}. 01.01 Type "What is your age?". 01.02 Demand A. 01.03 Type "You are", A. 01.04 Demand H as "What is your height?". 01.05 Type H,"? That tall?". ====Type==== The {{code|Type}} command outputs one or more items separated by commas. In its basic form it is equivalent to BASIC's {{code|PRINT}}. However, {{code|Type}} includes a number of optional forms that make it highly overloaded, performing a range of unrelated output tasks.{{sfn|Gimble|1967|p=66}} When used to print values, the parameters can be variables, literal strings surrounded by double-quotes, and the special {{code|_}} character that produces a line feed.{{sfn|Gimble|1967|p=7}} {{code|Type}} also supports formatted output using format strings. See the section on {{code|Form}} below for details.{{sfn|Gimble|1967|p=66}} Type is also used as the equivalent to BASIC's {{code|LIST}} statement, writing out the program. For instance, {{code|Type step 1.1.}} will print out a single line of code, while {{code|Type part 1.}} will print out the entire part, and {{code|Type all.}} prints out the entire program.{{sfn|Gimble|1967|p=66}} Further, it can also be used to print lists of internal values. {{code|Type all values.}} produces a list of all variables and their values, while {{code|Type size.}} prints out the program size. Keywords include {{code|size}}, {{code|time}} and {{code|users}}.{{sfn|Gimble|1967|p=66}} ====Page==== {{code|Page}} triggers a page feed on the special JOSS terminals.{{sfn|Gimble|1967|p=77}} JOSS would normally send a page feed when the terminal reached line 54 on the paper, so if one wanted to ensure a block of data would not be split in half, one could:{{sfn|Gimble|1967|p=49}} 1.10 Page if $>44. {{code|$}} is a pseudo-variable that returns the current line number.{{sfn|Gimble|1967|p=49}} ====Line==== {{code|Line}} triggers a line feed on the special JOSS terminals.{{sfn|Gimble|1967|p=77}} ====To==== The {{code|To}} command jumps program execution to the specified part or step number, using {{code|To part 1.}} or {{code|To step 1.1.}} respectively.{{sfn|Gimble|1967|p=67}} It is the equivalent of BASIC's {{code|GOTO}}. Contrast with {{code|Go}}, an indirect command used from the command line that starts programs, the equivalent of BASIC's {{code|RUN}}. 01.01 Demand A as "TYPE A NUMBER". 01.05 To step 1.01. 01.10 To part 1. ====Do==== {{code|Do}} is similar to {{code|To}}, but branches to a subroutine. As with {{code|To}}, you can {{code|Do part}} or {{code|Do step}}. If a step is provided, that single line is run and then returns to the statement after the {{code|Do}}. If a part is provided, execution starts at the first line of the block and continues until the end of the block is reached or a {{code|Done}} statement is encountered. 01.15 Do step 7.24. 01.16 Do part 8. {{code|Do}} had one special short form for looking in keeping with it being very common in most programs. This used the {{code|times}} modifier instead of a normal {{code|for}}, in the case for simple loops. So the following lines are equivalent:{{sfn|Gimble|1967|p=66}} Do part 1 for i=1(1)5. Do part 1, 5 times. JOSS maintains a pointer to the currently executing line, which a {{code|Do}} would change. However, it included a special "parenthetic do" that could be used in direct mode to test certain sections of the code without changing the main pointer. For instance, if the program stopped due to an error and it was not clear which section caused the problem, one might test a particular subroutine with:{{sfn|Gimble|1967|p=58}} (Do part 2.) ====Done==== The {{code|Done}} command returns from a subroutine call. As subroutines return automatically when the end of the part is reached, {{code|Done}} is only required for returning early, and is often used with a conditional. Equivalent to BASIC's {{code|RETURN}}. *Routine to ask the user for a positive value and repeat until it gets one 01.10 Demand X as "Enter a positive value greater than zero". 01.20 Done if X>0. 01.30 To step 1.1 ====Stop==== The {{code|Stop}} command terminates execution of the program and returns control to the editing environment. Equivalent to BASIC's {{code|END}} or {{code|STOP}}, although BASIC's {{code|STOP}} is intended to allow {{code|CONT}} to pick up execution at the same location, a feature that has no direct equivalent in JOSS's workspace-oriented system. 01.10 Type X. 01.20 Stop. ====Go==== Available in direct mode only, {{code|Go}} is the equivalent to BASIC's {{code|RUN}} and {{code|CONT}}, depending on whether a program is currently stopped due to an error or {{code|Stop}} command being encountered.{{sfn|Gimble|1967|p=57}} ====Cancel==== Another direct-mode-only command, {{code|Cancel}} is used when the program has stopped for an error and the user wants to reset the program, which it does by clearing the [[program counter]]. A {{code|Go}} would pick up at the last location, but issuing a {{code|Cancel}} makes {{code|Go}} start at the top again.{{sfn|Gimble|1967|p=53}} If the current breakpoint was due to a parenthetical {{code|(Do.)}}, one can issue a parenthetical cancel, {{code|(Cancel.)}}, to stop just that sub-execution and allow a {{code|Go}} to continue at the last non-parenthetical line.{{sfn|Gimble|1967|p=58}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)