A r t i c l e s
Navigation

Note: This site is
a bit older, personal views
may have changed.

M a i n P a g e

D i r e c t o r y

Ruby to Modern Pascal Cheatsheet


This will be updated with time, it is in no way complete nor will it ever be.

The languages contain some similarities with syntax but are extremely different in some respects.

comparing Ruby Modern Pascal
case bondage case sensitive case insensitive
type system dynamic typing, no strong declarations strong static typing with ways to escape
write line to std out puts() writeln()
write to stdout print() write()
incrementing i += 1
i = i + n
inc(i);
i:= i + n;
loop keyword yes no, use while or repeat
while loop while condition
something
end

while (conditions)
something1
something2
end

while condition do
something;

while (conditions) do
begin
something1;
something2;
end;

by value parameters default default
by reference parameters not available available, prefix function parameters with VAR keyword
semicolon is terminator no, like Basic yes, terminates statement
single line comments # comment // comment
multi line comments =begin
comments
=end
(* these comments *)
{ or these }
object purism everything tries to be an object not everything tries to be an object
assignment operator = :=
equal comparison == =
less than < same
greater than > same
built in string type yes yes
string character access s[i].chr s[i]
string character ordinal value access s[i] ord(s[i])
pointers available huh? yes
pointers to chars huh? pchar type ( ^char)
procedures/function available outside classes can be faked using global DEF's yes
Class Garbage Collection yes no (but can use old objects or records on the stack without even a free or create call needed)
String Garbage Collection yes yes (reference counted)
String bigger than 255 chars yes yes


About
This site is about programming and other things.
_ _ _