Formatting code for ProgrammingLanguagesSideBySide
======Programming Languages Side By Side======
This will show concepts and constructs in Perl, Ruby, and (...?) in a side-by-side comparison.
Very rough right now, so don't count on it for accuracy yet.
|| |=|Perl|=|Python|=|Ruby|=|""VisualBasic""||
||white space|
|required to separate words from other words; optional otherwise|
|required to define blocks and their nesting levels? and to separate words from other words?|
|required to separate words from other words; optional otherwise?|
|enforced by the IDE; optional additional spaces allowed for readability|
|
||comments|
|### comment...## (to eol)|
|### comment...## (to eol)|
|### comment...## (to eol)|
|##; comment...## (to eol)|
|
||block defs|
|##""{ ... }""##|
|defined by additional levels of indentation: must be equal amount of spaces/tabs in front of each line at a given block level|
|##""{ ... }""##|
|defined by specific statements; indentation done automatically by IDE|
|
||arrays/lists|
|##['sample', 1, 2, 'strings allowed']##|
|##['sample', 1, 2, 'strings allowed']##|
|##['sample', 1, 2, 'strings allowed']##|
|##Array('sample', 1, 2, 'strings allowed')##|
|
||array elements|
|##@array = ['a', 'b', 'c'];
$array[0]##
→ ##'a'##|
|##array = ['a', 'b', 'c']
array[0]##
→ ##'a'##|
|?|
|?|
|
||array slices|
|##@array[0,1]##
→ ##['a', 'b']##
##@array[0,2]##
→ ##['a', 'c']##|
|##array[0:1]##
→ ##['a']##
##array[0:2]##
→ ##['a', 'b']##
##array[1:3]##
→ ##['b', 'c']##|
|?|
|?|
|
||conditional blocks|
|##if (a < b) {
~# ...
} elsif (a > b) {
~# ...
} else {
~# ...
}##|
|##if a < b:
~# ...
else:
~if a > b:
~~# ...
~else:
~~# ...##|
|?|
|##If a < b Then
~; ...
""ElseIf"" a > b Then
~; ...
Else
~; ...
End If|
|
This will show concepts and constructs in Perl, Ruby, and (...?) in a side-by-side comparison.
Very rough right now, so don't count on it for accuracy yet.
|| |=|Perl|=|Python|=|Ruby|=|""VisualBasic""||
||white space|
|required to separate words from other words; optional otherwise|
|required to define blocks and their nesting levels? and to separate words from other words?|
|required to separate words from other words; optional otherwise?|
|enforced by the IDE; optional additional spaces allowed for readability|
|
||comments|
|### comment...## (to eol)|
|### comment...## (to eol)|
|### comment...## (to eol)|
|##; comment...## (to eol)|
|
||block defs|
|##""{ ... }""##|
|defined by additional levels of indentation: must be equal amount of spaces/tabs in front of each line at a given block level|
|##""{ ... }""##|
|defined by specific statements; indentation done automatically by IDE|
|
||arrays/lists|
|##['sample', 1, 2, 'strings allowed']##|
|##['sample', 1, 2, 'strings allowed']##|
|##['sample', 1, 2, 'strings allowed']##|
|##Array('sample', 1, 2, 'strings allowed')##|
|
||array elements|
|##@array = ['a', 'b', 'c'];
$array[0]##
→ ##'a'##|
|##array = ['a', 'b', 'c']
array[0]##
→ ##'a'##|
|?|
|?|
|
||array slices|
|##@array[0,1]##
→ ##['a', 'b']##
##@array[0,2]##
→ ##['a', 'c']##|
|##array[0:1]##
→ ##['a']##
##array[0:2]##
→ ##['a', 'b']##
##array[1:3]##
→ ##['b', 'c']##|
|?|
|?|
|
||conditional blocks|
|##if (a < b) {
~# ...
} elsif (a > b) {
~# ...
} else {
~# ...
}##|
|##if a < b:
~# ...
else:
~if a > b:
~~# ...
~else:
~~# ...##|
|?|
|##If a < b Then
~; ...
""ElseIf"" a > b Then
~; ...
Else
~; ...
End If|
|