Programming/Polyglot Problems: Difference between revisions

From etwiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Note|Syntax Highlighting is currently broken! Sorry :/|warn}}
''Have you ever gotten syntax errors because you know how to do the thing in one language but can't remember how to do that the other one?''
''Have you ever gotten syntax errors because you know how to do the thing in one language but can't remember how to do that the other one?''


==If-Statements==
==If-Statements==


Python
<syntaxhighlight lang='python' line>
<syntaxhighlight lang='python' line>
if condition:
if condition:
Line 12: Line 15:
</syntaxhighlight>
</syntaxhighlight>


Ruby
<syntaxhighlight lang='ruby' line>
<syntaxhighlight lang='ruby' line>
if condition
if condition

Revision as of 10:12, 30 March 2024

Syntax Highlighting is currently broken! Sorry :/

Have you ever gotten syntax errors because you know how to do the thing in one language but can't remember how to do that the other one?

If-Statements

Python

if condition:
  do_thing
elif other_condition:
  do_other_thing
else:
  do_else_thing

Ruby

if condition
  do_thing
elsif other_condition
  do_other_thing
else
  do_else_thing
end