09-09-2017, 07:10 PM
(09-09-2017, 06:20 AM)Siletrea Wrote: wow there is alot of stuff in this manual!
ok been poking around the RPGXP manual and theres a few things that aren't compleatly clear so if you guys don't mind I'm gonna post them here
Pseudo Variables
self
The current method's execution constituent.
nil
The only instance of the NilClass class. Signifies NIL.
apparently Pseudo variables can't be changed...so they're like CONSTANTS?
afraid this doesn't make much sense to me...can someone clarify this a tad more?
Numeric Literals
123 0d123
integer
-123
integer (signed)
123.45
floating point number
Floating point numbers beginning with a decimal point, like .1, are not allowed. They must be written with a leading zero (0.1).
1.2e-3
floating point number
0xffff
hexadecimal integer
0b1011
binary integer
0377 0o377
octal integer
Numeric literals can contain an underscore. The Ruby interpreter simply ignores these underscores and does not interpret them in a special way. This can be useful as a thousands separator for large values. However, placing an underscore before and after a literal or connecting literals with an underscore will result in an error.
1_000_000_000 # => 1000000000
0xffff_ffff # => 0xffffffff
String Literals
Example:
"this is a string expression\n"
'this is a string expression'
String expressions begin and end with double or single quote marks.
Double-quoted string expressions are subject to backslash notation and expression substitution. Single-quoted strings are not (except for \' and \\).
String literals with white space on either side are treated as a single string literal.
p "foo" "bar" # => "foobar"
Backslash Notation
\t
tab (0x09)
\n
newline (0x0a)
\r
carriage return (0x0d)
\f
form feed (0x0c)
\s
whitespace (0x20)
\nnn
character at octal value nnn (n = 0-7)
\xnn
character at hexadecimal value nn (n = 0-9, a-f)
Expression Substitution
In double-quoted strings and regular expressions, the form "#{expression}" can be extended to the (string of the) contents of that expression. If the expressions are variables beginning with either $ or @, the surrounding braces may be omitted and the variable can be expressed as a #variable. The character # is interpreted literally if it is not followed by the characters {, $, or @. To explicitly prevent expression substitution, place a backslash in front of the #.
$ruby = "RUBY"
p "my name is #{$ruby}" # => "my name is RUBY"
p 'my name is #{$ruby}' # => "my name is #{$ruby}"
yeah there's alot of good information here but it doesn't make to much sense...are these used very often in scripting?
new logo for Yesteryear created by Lunarberry!