Statements
Operators that do work and give no value.
Every program can use these operators. No import is necessary.
| Operator | Arguments | Gives |
|---|---|---|
= |
left: <optional>T, right: <optional>T | void |
= |
left: <optional>T, right: <optional>T | void |
= |
left: <optional>T, right: T | void |
= |
left: <optional>T, right: T | void |
= |
left: T, right: <optional>T | void |
= |
immutable_left: T, immutable_right: T | void |
= |
left: T, right: T | void |
= |
target: vref, expr: expression | void |
begin_dispatch_turn |
root: RangerProcessBase | void |
break |
— | void |
break |
_: T | void |
buffer_copy |
dest: buffer, destOffset: int, src: buffer, srcOffset: int, length: int | void |
buffer_fill |
buf: buffer, value: int, start: int, end: int | void |
buffer_set |
buf: buffer, offset: int, value: int | void |
buffer_write_file |
path: string, filename: string, buf: buffer | void |
case |
condition: char, case_block: block | void |
case |
condition: int, case_block: block | void |
case |
condition: string, case_block: block | void |
case |
condition: T, case_block: block | void |
clear_screen |
— | void |
continue |
— | void |
continue |
_: T | void |
create_dir |
path: string | void |
def |
varname: T | void |
def |
varname: T, value: T | void |
def |
varname: T, value: T | void |
default |
default_block: block | void |
double_buffer_copy |
dest: double_buffer, destOffset: int, src: double_buffer, srcOffset: int, length: int | void |
double_buffer_fill |
buf: double_buffer, value: double, start: int, end: int | void |
double_buffer_set |
buf: double_buffer, index: int, value: double | void |
end_dispatch_turn |
root: RangerProcessBase | void |
exit |
code: int | void |
gitdoc |
value: string | void |
golang_wait |
seconds: double | void |
hide_cursor |
— | void |
http_send |
res: HttpResponse, body: string | void |
http_send_buffer |
res: HttpResponse, content: buffer | void |
http_send_bytes |
res: HttpResponse, content: charbuffer | void |
http_set_header |
res: HttpResponse, name: string, value: string | void |
http_set_status |
res: HttpResponse, code: int | void |
if |
condition: boolean, then_block: block | void |
if |
condition: boolean, then_block: block, else_block: block | void |
if |
condition: boolean, then_block: block, else: else_block | void |
if |
condition: <optional>double, then_block: block | void |
if |
condition: <optional>double, then_block: block | void |
if |
condition: <optional>int, then_block: block | void |
if |
condition: <optional>int, then_block: block | void |
if |
condition: <optional>T, then_block: block | void |
if |
condition: <optional>T, then_block: block | void |
if! |
condition: boolean, then_block: block | void |
if! |
condition: boolean, then_block: block, else_block: block | void |
if! |
condition: boolean, then_block: block, else: else_block | void |
int_buffer_copy |
dest: int_buffer, destOffset: int, src: int_buffer, srcOffset: int, length: int | void |
int_buffer_fill |
buf: int_buffer, value: int, start: int, end: int | void |
int_buffer_set |
buf: int_buffer, index: int, value: int | void |
move_cursor |
x: int, y: int | void |
nullify |
ptr: <optional>T | void |
on_keypress |
keyvar: string, code: block | void |
print |
text: string | void |
proc_start |
proc: RangerProcessBase | void |
proc_stop |
processId: int | void |
proc_stop |
proc: RangerProcessBase | void |
proc_stop |
className: string | void |
proc_wakeup |
proc: RangerProcessBase, state: string | void |
return |
— | void |
return |
value: <optional>T | <optional>void |
return |
value: T | void |
return |
value: T | void |
set_exit_code |
code: int | void |
show_cursor |
— | void |
sleep_ms |
ms: int | void |
sse_send |
client: SSEClient, event: string, data: string | void |
start |
server: HttpServer, port: int | void |
stop |
server: HttpServer | void |
str_append |
target: string, item: string | void |
switch |
condition: char, case_list: block | void |
switch |
condition: int, case_list: block | void |
switch |
condition: string, case_list: block | void |
switch |
condition: T, case_list: block | void |
switch |
condition: T, case_list: block | void |
throw |
eInfo: string | void |
throw |
eInfo: T | void |
timer |
name: string, code: block | void |
try |
try_block: block, catch_block: block | void |
wait |
seconds: double | void |
wait |
seconds: double, after: block | void |
while |
condition: boolean, whileLoop: block | void |
write |
text: string | void |
write_file |
path: string, file: string, data: string | void |
Target support marks
- Own template
- Default template
- No template
The operator works for a target with an own template and for a target with the default template. The default template is the * entry of the definition: it writes the same code for every target that has no template of its own. A target with no template writes no code, and a program that uses the operator does not compile for that target.
=
(= left right) → void
=(left: <optional>T, right: <optional>T)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: default template
- Java: own template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: own template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 4235
=
(= left right) → void
=(left: <optional>T, right: <optional>T)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: own template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 4467
=
(= left right) → void
=(left: <optional>T, right: T)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: default template
- Java: own template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: own template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 4222
=
(= left right) → void
=(left: <optional>T, right: T)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: own template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 4448
=
(= left right) → void
=(left: T, right: <optional>T)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: own template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 4457
=
(= immutable_left immutable_right) → void
=(immutable_left: T, immutable_right: T)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: own template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 4195
=
(= left right) → void
=(left: T, right: T)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: own template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 4207
=
(= target expr) → void
=(target: vref, expr: expression)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 4918
begin_dispatch_turn
(begin_dispatch_turn root) → void
begin_dispatch_turn(root: RangerProcessBase)proc_send is lowered in RangerProcessProcSend.rgr (typed handler methods, overload match).
Target support
- JavaScript: own template
- TypeScript: own template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 11812
break
(break) → voidTarget support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 5448
break
(break _) → void
break(_: T)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 5456
buffer_copy
(buffer_copy dest destOffset src srcOffset length) → void
buffer_copy(dest: buffer, destOffset: int, src: buffer, srcOffset: int, length: int)Copy bytes from source buffer to destination buffer
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: no template
Definition: compiler/Lang.rgr, line 7045
buffer_fill
(buffer_fill buf value start end) → void
buffer_fill(buf: buffer, value: int, start: int, end: int)Fill buffer with a byte value
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: no template
- Scala: no template
Definition: compiler/Lang.rgr, line 7063
buffer_set
(buffer_set buf offset value) → void
buffer_set(buf: buffer, offset: int, value: int)Write a single byte at offset (value should be 0-255)
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: no template
Definition: compiler/Lang.rgr, line 6854
buffer_write_file
(buffer_write_file path filename buf) → void
buffer_write_file(path: string, filename: string, buf: buffer)Write buffer to a binary file
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: no template
Definition: compiler/Lang.rgr, line 6974
case
(case condition case_block) → void
case(condition: char, case_block: block)Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: default template
- C#: default template
- C++: own template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 5311
case
(case condition case_block) → void
case(condition: int, case_block: block)Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: default template
- C#: default template
- C++: own template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 5329
case
(case condition case_block) → void
case(condition: string, case_block: block)A case over a string needs its own entry for Rust only: a match arm is a pattern, and the Rust writer gives a string literal in expression position a `.to_string()`, which a pattern does not take. `(estr 1)` writes the text of the literal, escaped and unquoted -- escaped because a pattern holding a raw quote, backslash or newline ends early, which is how `case "\""` became `"""`. Every other target keeps the spelling of the case above.
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: default template
- C++: own template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 5393
case
(case condition case_block) → void
case(condition: T, case_block: block)Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: default template
- C#: default template
- C++: own template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 5410
clear_screen
(clear_screen) → voidClear the terminal screen
Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: default template
Definition: compiler/Lang.rgr, line 10413
continue
(continue) → voidTarget support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 5464
continue
(continue _) → void
continue(_: T)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 5472
create_dir
(create_dir path) → void
create_dir(path: string)Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 3549
def
(def varname) → void
def(varname: T)Target support
- JavaScript: own template
- TypeScript: own template
- Go: default template
- Rust: default template
- Python: default template
- Java: own template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 4374
def
(def varname value) → void
def(varname: T, value: T)Target support
- JavaScript: own template
- TypeScript: own template
- Go: default template
- Rust: default template
- Python: default template
- Java: own template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 4385
def
(def varname value) → void
def(varname: T, value: T)Target support
- JavaScript: own template
- TypeScript: own template
- Go: default template
- Rust: default template
- Python: default template
- Java: own template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 4395
default
(default default_block) → void
default(default_block: block)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 5426
double_buffer_copy
(double_buffer_copy dest destOffset src srcOffset length) → void
double_buffer_copy(dest: double_buffer, destOffset: int, src: double_buffer, srcOffset: int, length: int)Copy doubles from source to destination
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: no template
- Scala: no template
Definition: compiler/Lang.rgr, line 7324
double_buffer_fill
(double_buffer_fill buf value start end) → void
double_buffer_fill(buf: double_buffer, value: double, start: int, end: int)Fill double_buffer with a value in range [start, end)
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: no template
- Scala: no template
Definition: compiler/Lang.rgr, line 7307
double_buffer_set
(double_buffer_set buf index value) → void
double_buffer_set(buf: double_buffer, index: int, value: double)Write a double at index
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: no template
- Scala: no template
Definition: compiler/Lang.rgr, line 7290
end_dispatch_turn
(end_dispatch_turn root) → void
end_dispatch_turn(root: RangerProcessBase)Target support
- JavaScript: own template
- TypeScript: own template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 11822
exit
(exit code) → void
exit(code: int)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 11246
gitdoc
(gitdoc value) → void
gitdoc(value: string)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 4949
golang_wait
(golang_wait seconds) → void
golang_wait(seconds: double)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 1406
hide_cursor
(hide_cursor) → voidHide terminal cursor
Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: default template
Definition: compiler/Lang.rgr, line 10449
http_send
(http_send res body) → void
http_send(res: HttpResponse, body: string)Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 11721
http_send_buffer
(http_send_buffer res content) → void
http_send_buffer(res: HttpResponse, content: buffer)Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 11737
http_send_bytes
(http_send_bytes res content) → void
http_send_bytes(res: HttpResponse, content: charbuffer)Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 11729
http_set_header
(http_set_header res name value) → void
http_set_header(res: HttpResponse, name: string, value: string)Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 11713
http_set_status
(http_set_status res code) → void
http_set_status(res: HttpResponse, code: int)HTTP Response Operators
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 11705
if
(if condition then_block) → void
if(condition: boolean, then_block: block)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 5133
if
(if condition then_block else_block) → void
if(condition: boolean, then_block: block, else_block: block)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Condition and loop
class Main { sfn main:void () { def limit 3 if (limit > 2) { print "the limit is greater than two" } { print "the limit is small" } def index 0 while (index < limit) { print ("step " + index) index = index + 1 } }}const limit = 3;if ( limit > 2 ) { console.log("the limit is greater than two");} else { console.log("the limit is small");}let index = 0;while (index < limit) { console.log("step " + index); index = index + 1;};The complete file
class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const limit = 3; if ( limit > 2 ) { console.log("the limit is greater than two"); } else { console.log("the limit is small"); } let index = 0; while (index < limit) { console.log("step " + index); index = index + 1; };}__js_main();const limit : number = 3;if ( limit > 2 ) { console.log("the limit is greater than two");} else { console.log("the limit is small");}let index : number = 0;while (index < limit) { console.log("step " + index); index = index + 1;};The complete file
export class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const limit : number = 3; if ( limit > 2 ) { console.log("the limit is greater than two"); } else { console.log("the limit is small"); } let index : number = 0; while (index < limit) { console.log("step " + index); index = index + 1; };}__js_main();var limit int64= int64(3);if limit > int64(2) { fmt.Println( "the limit is greater than two" )} else { fmt.Println( "the limit is small" )}var index int64= int64(0);for index < limit { fmt.Println( strings.Join([]string{ "step ",strconv.FormatInt(index, 10) }, "") ) index = index + int64(1);}The complete file
package mainimport ( "fmt" "strings" "strconv")type Main struct {}
func CreateNew_Main() *Main { me := new(Main) return me;}func main() { var limit int64= int64(3); if limit > int64(2) { fmt.Println( "the limit is greater than two" ) } else { fmt.Println( "the limit is small" ) } var index int64= int64(0); for index < limit { fmt.Println( strings.Join([]string{ "step ",strconv.FormatInt(index, 10) }, "") ) index = index + int64(1); }}let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread");__rg_main_thread.join().expect("main thread panicked");The complete file
#![allow(dead_code)]
#[derive(Clone)]struct Main {}impl Main { pub fn new() -> Self { Self { } }}fn main() { let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread"); __rg_main_thread.join().expect("main thread panicked");}fn __rg_main_body() { let limit: i64 = 3; if limit > 2 { println!("the limit is greater than two"); } else { println!("the limit is small"); } let mut index: i64 = 0; while index < limit { println!("step {}", index); index += 1; };}limit = 3if limit > 2: print("the limit is greater than two")else: print("the limit is small")index = 0while index < limit: print("step " + str(index)) index = index + 1;The complete file
# -*- coding: utf-8 -*-from __future__ import annotationsfrom typing import Optional
class Main: def __init__(self) -> None: pass# Main entry pointdef main(): limit = 3 if limit > 2: print("the limit is greater than two") else: print("the limit is small") index = 0 while index < limit: print("step " + str(index)) index = index + 1;if __name__ == "__main__": main()RgArgs.args = args;final Integer limit = 3;if ( limit > 2 ) { System.out.println(String.valueOf( "the limit is greater than two" ) );} else { System.out.println(String.valueOf( "the limit is small" ) );}Integer index = 0;while (index < limit) { System.out.println(String.valueOf( "step " + index ) ); index = index + 1;}The complete file
import java.io.*;
public class Main {
public static void main(String [] args ) { RgArgs.args = args; final Integer limit = 3; if ( limit > 2 ) { System.out.println(String.valueOf( "the limit is greater than two" ) ); } else { System.out.println(String.valueOf( "the limit is small" ) ); } Integer index = 0; while (index < limit) { System.out.println(String.valueOf( "step " + index ) ); index = index + 1; } }}
public class RgArgs { public static String[] args = new String[0];}__g_args = argsval limit : Int = 3;if ( limit > 2 ) { println( "the limit is greater than two" )} else { println( "the limit is small" )}var index : Int = 0;while (index < limit) { println( "step " + (index).toString() ) index = index + 1;}The complete file
class Main {
}
var __g_args : Array<String> = arrayOf()
fun main(args : Array<String>) { __g_args = args val limit : Int = 3; if ( limit > 2 ) { println( "the limit is greater than two" ) } else { println( "the limit is small" ) } var index : Int = 0; while (index < limit) { println( "step " + (index).toString() ) index = index + 1; }}__g_args = args;int limit = 3;if ( limit > 2 ) { print( "the limit is greater than two" );} else { print( "the limit is small" );}int index = 0;while (index < limit) { print( "step " + (index).toString() ); index = index + 1;}The complete file
class Main {}
List<String> __g_args = <String>[];
void main(List<String> args) { __g_args = args; int limit = 3; if ( limit > 2 ) { print( "the limit is greater than two" ); } else { print( "the limit is small" ); } int index = 0; while (index < limit) { print( "step " + (index).toString() ); index = index + 1; }}let limit : Int = 3if ( limit > 2 ) { print("the limit is greater than two")} else { print("the limit is small")}var index : Int = 0while (index < limit) { print("step " + String(index)) index = index + 1;}The complete file
func ==(l: Main, r: Main) -> Bool { return l === r}final class Main : Hashable { func hash(into hasher: inout Hasher) { hasher.combine(ObjectIdentifier(self)) }}// Main entry pointfunc __main__swift() { let limit : Int = 3 if ( limit > 2 ) { print("the limit is greater than two") } else { print("the limit is small") } var index : Int = 0 while (index < limit) { print("step " + String(index)) index = index + 1; }}__main__swift()int limit = 3;if ( limit > 2 ) { Console.WriteLine("the limit is greater than two");} else { Console.WriteLine("the limit is small");}int index = 0;while (index < limit) { Console.WriteLine("step " + index); index = index + 1;}The complete file
using System;class Main { static void Main( string [] args ) { int limit = 3; if ( limit > 2 ) { Console.WriteLine("the limit is greater than two"); } else { Console.WriteLine("the limit is small"); } int index = 0; while (index < limit) { Console.WriteLine("step " + index); index = index + 1; } }}int limit = 3;if ( limit > 2 ) { std::cout << std::string("the limit is greater than two") << std::endl;} else { std::cout << std::string("the limit is small") << std::endl;}int index = 0;while (index < limit) { std::cout << std::string("step ") + std::to_string(index) << std::endl; index = index + 1;};return 0;The complete file
#include <memory>#include <iostream>#include <string>
// define classes here to avoid compiler errorsclass Main;
// header definitionsclass Main { public : /* class constructor */ Main( ); /* static methods */ static void main();};
int __g_argc;char **__g_argv;Main::Main( ) {}int main(int argc, char* argv[]) { __g_argc = argc; __g_argv = argv; int limit = 3; if ( limit > 2 ) { std::cout << std::string("the limit is greater than two") << std::endl; } else { std::cout << std::string("the limit is small") << std::endl; } int index = 0; while (index < limit) { std::cout << std::string("step ") + std::to_string(index) << std::endl; index = index + 1; }; return 0;}$limit = 3;if ( $limit > 2 ) { echo( "the limit is greater than two" . "\n");} else { echo( "the limit is small" . "\n");}$index = 0;while ($index < $limit) { echo( "step " . $index . "\n"); $index = $index + 1;}The complete file
<?php
class Main { function __construct( ) { }}/* static PHP main routine */$limit = 3;if ( $limit > 2 ) { echo( "the limit is greater than two" . "\n");} else { echo( "the limit is small" . "\n");}$index = 0;while ($index < $limit) { echo( "step " . $index . "\n"); $index = $index + 1;}val limit : Int = 3if ( limit > 2 ) { println( "the limit is greater than two" )} else { println( "the limit is small" )}var index : Int = 0try { val __break__ = new Breaks; __break__.breakable { while (index < limit) { val __continue__ = new Breaks; __continue__.breakable { println( "step " + index ) index = index + 1 } } }}The complete file
import scala.util.control._case class ScalaReturnValue(value:Any) extends Exception
// application main function for Mainobject AppMain extends App { val limit : Int = 3 if ( limit > 2 ) { println( "the limit is greater than two" ) } else { println( "the limit is small" ) } var index : Int = 0 try { val __break__ = new Breaks; __break__.breakable { while (index < limit) { val __continue__ = new Breaks; __continue__.breakable { println( "step " + index ) index = index + 1 } } } }}Definition: compiler/Lang.rgr, line 5123
if
(if condition then_block else) → void
if(condition: boolean, then_block: block, else: else_block)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: own template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 5098
if
(if condition then_block) → void
if(condition: <optional>double, then_block: block)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 5167
if
(if condition then_block) → void
if(condition: <optional>double, then_block: block)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 5208
if
(if condition then_block) → void
if(condition: <optional>int, then_block: block)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 5143
if
(if condition then_block) → void
if(condition: <optional>int, then_block: block)typed optional int/double with an else branch: r_optional_primitive is a value type (has_value field), not a pointer, so the generic :T `!= NULL` form below does not compile under clang. Emit `.has_value`.
Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 5189
if
(if condition then_block) → void
if(condition: <optional>T, then_block: block)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 5227
if
(if condition then_block) → void
if(condition: <optional>T, then_block: block)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 5249
if!
(if! condition then_block) → void
if!(condition: boolean, then_block: block)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 5116
if!
(if! condition then_block else_block) → void
if!(condition: boolean, then_block: block, else_block: block)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 5110
if!
(if! condition then_block else) → void
if!(condition: boolean, then_block: block, else: else_block)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 5104
int_buffer_copy
(int_buffer_copy dest destOffset src srcOffset length) → void
int_buffer_copy(dest: int_buffer, destOffset: int, src: int_buffer, srcOffset: int, length: int)Copy ints from source to destination
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: no template
- Scala: no template
Definition: compiler/Lang.rgr, line 7197
int_buffer_fill
(int_buffer_fill buf value start end) → void
int_buffer_fill(buf: int_buffer, value: int, start: int, end: int)Fill int_buffer with a value in range [start, end)
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: no template
- Scala: no template
Definition: compiler/Lang.rgr, line 7179
int_buffer_set
(int_buffer_set buf index value) → void
int_buffer_set(buf: int_buffer, index: int, value: int)Write an int64 at index
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: no template
- Scala: no template
Definition: compiler/Lang.rgr, line 7161
move_cursor
(move_cursor x y) → void
move_cursor(x: int, y: int)Move cursor to position (1-based coordinates)
Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: default template
Definition: compiler/Lang.rgr, line 10431
nullify
(nullify ptr) → void
nullify(ptr: <optional>T)Clears the optional value to empty state
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 1287
on_keypress
(on_keypress keyvar code) → void
on_keypress(keyvar: string, code: block)Listen for keyboard input - callback receives key:string Creates a global key queue/receiver that poll_keypress can use
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: default template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: default template
- C++: own template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 10486
print
(print text) → void
print(text: string)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 10373
proc_start
(proc_start proc) → void
proc_start(proc: RangerProcessBase)Target support
- JavaScript: own template
- TypeScript: own template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 11832
proc_stop
(proc_stop processId) → void
proc_stop(processId: int)Target support
- JavaScript: own template
- TypeScript: own template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 11852
proc_stop
(proc_stop proc) → void
proc_stop(proc: RangerProcessBase)Target support
- JavaScript: own template
- TypeScript: own template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 11842
proc_stop
(proc_stop className) → void
proc_stop(className: string)Target support
- JavaScript: own template
- TypeScript: own template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 11862
proc_wakeup
(proc_wakeup proc state) → void
proc_wakeup(proc: RangerProcessBase, state: string)Target support
- JavaScript: own template
- TypeScript: own template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 11882
return
(return) → voidTarget support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: own template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 4437
return
(return value) → <optional>void
return(value: <optional>T)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: default template
- Java: own template
- Kotlin: default template
- Dart: default template
- Swift: own template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 4412
return
(return value) → void
return(value: T)Target support
- JavaScript: no template
- TypeScript: no template
- Go: own template
- Rust: no template
- Python: no template
- Java: no template
- Kotlin: no template
- Dart: no template
- Swift: own template
- C#: no template
- C++: no template
- PHP: no template
- Scala: no template
Definition: compiler/Lang.rgr, line 4404
return
(return value) → void
return(value: T)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: own template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 4425
set_exit_code
(set_exit_code code) → void
set_exit_code(code: int)Set the status this program ends with, WITHOUT ending it here. `exit` stops the process at once, and on node a stdout that is a pipe -- `$(rgrc ... 2>&1)`, a log file, CI -- is written asynchronously, so whatever was printed last is dropped on the floor. That is exactly the error report the non-zero status is about. So set the code and let the program end on its own. The targets whose stdout is unbuffered or flushed at exit have nothing to defer and exit here.
Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 11225
show_cursor
(show_cursor) → voidShow terminal cursor
Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: default template
Definition: compiler/Lang.rgr, line 10467
sleep_ms
(sleep_ms ms) → void
sleep_ms(ms: int)Sleep for specified milliseconds (blocking)
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: default template
Definition: compiler/Lang.rgr, line 11199
sse_send
(sse_send client event data) → void
sse_send(client: SSEClient, event: string, data: string)SSE (Server-Sent Events) Operators
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 11749
start
(start server port) → void
start(server: HttpServer, port: int)Start HTTP server - wires up all @(GET), @(POST), @(SSE) routes and starts listening Usage: start server 8080 OR start server (uses default port from annotation) The Go writer generates http.HandleFunc calls for each annotated method
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 11776
stop
(stop server) → void
stop(server: HttpServer)Stop HTTP server gracefully Usage: stop server
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 11791
str_append
(str_append target item) → void
str_append(target: string, item: string)In-place string append: `str_append s suffix`. On targets whose string is mutable (C++ std::string, Rust String) this is an amortized-O(len(suffix)) grow; immutable-string targets lower it to `a = a + b`, one copy, which is what they would spell anyway. The interpreter's slot machinery drives `s += "..."` through it once a binding's string is proven unshared.
Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 10028
switch
(switch condition case_list) → void
switch(condition: char, case_list: block)Python and Rust have no C style switch. Python 3.10 `match` and the Rust `match` expression take the same shape, so `switch` lowers onto them and `case` / `default` carry the matching arm spelling.
Target support
- JavaScript: no template
- TypeScript: no template
- Go: own template
- Rust: own template
- Python: own template
- Java: no template
- Kotlin: no template
- Dart: no template
- Swift: no template
- C#: no template
- C++: no template
- PHP: no template
- Scala: no template
Definition: compiler/Lang.rgr, line 5270
switch
(switch condition case_list) → void
switch(condition: int, case_list: block)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: own template
- Python: own template
- Java: default template
- Kotlin: own template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 5293
switch
(switch condition case_list) → void
switch(condition: string, case_list: block)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: own template
- Python: own template
- Java: default template
- Kotlin: own template
- Dart: default template
- Swift: default template
- C#: default template
- C++: own template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 5345
switch
(switch condition case_list) → void
switch(condition: T, case_list: block)Target support
- JavaScript: no template
- TypeScript: no template
- Go: no template
- Rust: no template
- Python: no template
- Java: no template
- Kotlin: no template
- Dart: no template
- Swift: own template
- C#: no template
- C++: no template
- PHP: no template
- Scala: no template
Definition: compiler/Lang.rgr, line 5286
switch
(switch condition case_list) → void
switch(condition: T, case_list: block)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: own template
- Python: own template
- Java: default template
- Kotlin: own template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Definition: compiler/Lang.rgr, line 5362
throw
(throw eInfo) → void
throw(eInfo: string)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 5686
throw
(throw eInfo) → void
throw(eInfo: T)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 5747
timer
(timer name code) → void
timer(name: string, code: block)Profiling
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: default template
- Python: default template
- Java: own template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: own template
- PHP: own template
- Scala: default template
Definition: compiler/Lang.rgr, line 1456
try
(try try_block catch_block) → void
try(try_block: block, catch_block: block)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 5754
wait
(wait seconds) → void
wait(seconds: double)Target support
- JavaScript: own template
- TypeScript: own template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 1413
wait
(wait seconds after) → void
wait(seconds: double, after: block)Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: no template
- Python: own template
- Java: own template
- Kotlin: no template
- Dart: no template
- Swift: own template
- C#: no template
- C++: own template
- PHP: own template
- Scala: no template
Definition: compiler/Lang.rgr, line 1420
while
(while condition whileLoop) → void
while(condition: boolean, whileLoop: block)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: own template
Condition and loop
class Main { sfn main:void () { def limit 3 if (limit > 2) { print "the limit is greater than two" } { print "the limit is small" } def index 0 while (index < limit) { print ("step " + index) index = index + 1 } }}const limit = 3;if ( limit > 2 ) { console.log("the limit is greater than two");} else { console.log("the limit is small");}let index = 0;while (index < limit) { console.log("step " + index); index = index + 1;};The complete file
class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const limit = 3; if ( limit > 2 ) { console.log("the limit is greater than two"); } else { console.log("the limit is small"); } let index = 0; while (index < limit) { console.log("step " + index); index = index + 1; };}__js_main();const limit : number = 3;if ( limit > 2 ) { console.log("the limit is greater than two");} else { console.log("the limit is small");}let index : number = 0;while (index < limit) { console.log("step " + index); index = index + 1;};The complete file
export class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const limit : number = 3; if ( limit > 2 ) { console.log("the limit is greater than two"); } else { console.log("the limit is small"); } let index : number = 0; while (index < limit) { console.log("step " + index); index = index + 1; };}__js_main();var limit int64= int64(3);if limit > int64(2) { fmt.Println( "the limit is greater than two" )} else { fmt.Println( "the limit is small" )}var index int64= int64(0);for index < limit { fmt.Println( strings.Join([]string{ "step ",strconv.FormatInt(index, 10) }, "") ) index = index + int64(1);}The complete file
package mainimport ( "fmt" "strings" "strconv")type Main struct {}
func CreateNew_Main() *Main { me := new(Main) return me;}func main() { var limit int64= int64(3); if limit > int64(2) { fmt.Println( "the limit is greater than two" ) } else { fmt.Println( "the limit is small" ) } var index int64= int64(0); for index < limit { fmt.Println( strings.Join([]string{ "step ",strconv.FormatInt(index, 10) }, "") ) index = index + int64(1); }}let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread");__rg_main_thread.join().expect("main thread panicked");The complete file
#![allow(dead_code)]
#[derive(Clone)]struct Main {}impl Main { pub fn new() -> Self { Self { } }}fn main() { let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread"); __rg_main_thread.join().expect("main thread panicked");}fn __rg_main_body() { let limit: i64 = 3; if limit > 2 { println!("the limit is greater than two"); } else { println!("the limit is small"); } let mut index: i64 = 0; while index < limit { println!("step {}", index); index += 1; };}limit = 3if limit > 2: print("the limit is greater than two")else: print("the limit is small")index = 0while index < limit: print("step " + str(index)) index = index + 1;The complete file
# -*- coding: utf-8 -*-from __future__ import annotationsfrom typing import Optional
class Main: def __init__(self) -> None: pass# Main entry pointdef main(): limit = 3 if limit > 2: print("the limit is greater than two") else: print("the limit is small") index = 0 while index < limit: print("step " + str(index)) index = index + 1;if __name__ == "__main__": main()RgArgs.args = args;final Integer limit = 3;if ( limit > 2 ) { System.out.println(String.valueOf( "the limit is greater than two" ) );} else { System.out.println(String.valueOf( "the limit is small" ) );}Integer index = 0;while (index < limit) { System.out.println(String.valueOf( "step " + index ) ); index = index + 1;}The complete file
import java.io.*;
public class Main {
public static void main(String [] args ) { RgArgs.args = args; final Integer limit = 3; if ( limit > 2 ) { System.out.println(String.valueOf( "the limit is greater than two" ) ); } else { System.out.println(String.valueOf( "the limit is small" ) ); } Integer index = 0; while (index < limit) { System.out.println(String.valueOf( "step " + index ) ); index = index + 1; } }}
public class RgArgs { public static String[] args = new String[0];}__g_args = argsval limit : Int = 3;if ( limit > 2 ) { println( "the limit is greater than two" )} else { println( "the limit is small" )}var index : Int = 0;while (index < limit) { println( "step " + (index).toString() ) index = index + 1;}The complete file
class Main {
}
var __g_args : Array<String> = arrayOf()
fun main(args : Array<String>) { __g_args = args val limit : Int = 3; if ( limit > 2 ) { println( "the limit is greater than two" ) } else { println( "the limit is small" ) } var index : Int = 0; while (index < limit) { println( "step " + (index).toString() ) index = index + 1; }}__g_args = args;int limit = 3;if ( limit > 2 ) { print( "the limit is greater than two" );} else { print( "the limit is small" );}int index = 0;while (index < limit) { print( "step " + (index).toString() ); index = index + 1;}The complete file
class Main {}
List<String> __g_args = <String>[];
void main(List<String> args) { __g_args = args; int limit = 3; if ( limit > 2 ) { print( "the limit is greater than two" ); } else { print( "the limit is small" ); } int index = 0; while (index < limit) { print( "step " + (index).toString() ); index = index + 1; }}let limit : Int = 3if ( limit > 2 ) { print("the limit is greater than two")} else { print("the limit is small")}var index : Int = 0while (index < limit) { print("step " + String(index)) index = index + 1;}The complete file
func ==(l: Main, r: Main) -> Bool { return l === r}final class Main : Hashable { func hash(into hasher: inout Hasher) { hasher.combine(ObjectIdentifier(self)) }}// Main entry pointfunc __main__swift() { let limit : Int = 3 if ( limit > 2 ) { print("the limit is greater than two") } else { print("the limit is small") } var index : Int = 0 while (index < limit) { print("step " + String(index)) index = index + 1; }}__main__swift()int limit = 3;if ( limit > 2 ) { Console.WriteLine("the limit is greater than two");} else { Console.WriteLine("the limit is small");}int index = 0;while (index < limit) { Console.WriteLine("step " + index); index = index + 1;}The complete file
using System;class Main { static void Main( string [] args ) { int limit = 3; if ( limit > 2 ) { Console.WriteLine("the limit is greater than two"); } else { Console.WriteLine("the limit is small"); } int index = 0; while (index < limit) { Console.WriteLine("step " + index); index = index + 1; } }}int limit = 3;if ( limit > 2 ) { std::cout << std::string("the limit is greater than two") << std::endl;} else { std::cout << std::string("the limit is small") << std::endl;}int index = 0;while (index < limit) { std::cout << std::string("step ") + std::to_string(index) << std::endl; index = index + 1;};return 0;The complete file
#include <memory>#include <iostream>#include <string>
// define classes here to avoid compiler errorsclass Main;
// header definitionsclass Main { public : /* class constructor */ Main( ); /* static methods */ static void main();};
int __g_argc;char **__g_argv;Main::Main( ) {}int main(int argc, char* argv[]) { __g_argc = argc; __g_argv = argv; int limit = 3; if ( limit > 2 ) { std::cout << std::string("the limit is greater than two") << std::endl; } else { std::cout << std::string("the limit is small") << std::endl; } int index = 0; while (index < limit) { std::cout << std::string("step ") + std::to_string(index) << std::endl; index = index + 1; }; return 0;}$limit = 3;if ( $limit > 2 ) { echo( "the limit is greater than two" . "\n");} else { echo( "the limit is small" . "\n");}$index = 0;while ($index < $limit) { echo( "step " . $index . "\n"); $index = $index + 1;}The complete file
<?php
class Main { function __construct( ) { }}/* static PHP main routine */$limit = 3;if ( $limit > 2 ) { echo( "the limit is greater than two" . "\n");} else { echo( "the limit is small" . "\n");}$index = 0;while ($index < $limit) { echo( "step " . $index . "\n"); $index = $index + 1;}val limit : Int = 3if ( limit > 2 ) { println( "the limit is greater than two" )} else { println( "the limit is small" )}var index : Int = 0try { val __break__ = new Breaks; __break__.breakable { while (index < limit) { val __continue__ = new Breaks; __continue__.breakable { println( "step " + index ) index = index + 1 } } }}The complete file
import scala.util.control._case class ScalaReturnValue(value:Any) extends Exception
// application main function for Mainobject AppMain extends App { val limit : Int = 3 if ( limit > 2 ) { println( "the limit is greater than two" ) } else { println( "the limit is small" ) } var index : Int = 0 try { val __break__ = new Breaks; __break__.breakable { while (index < limit) { val __continue__ = new Breaks; __continue__.breakable { println( "step " + index ) index = index + 1 } } } }}Definition: compiler/Lang.rgr, line 5481
write
(write text) → void
write(text: string)Terminal control operators for console/shell games Write text without newline
Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: default template
Definition: compiler/Lang.rgr, line 10395
write_file
(write_file path file data) → void
write_file(path: string, file: string, data: string)try text.write(to: path, atomically: false, encoding: String.Encoding.utf8)
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 3660
Ranger 3.5.1 · commit f323fd4 · development build