Programming/Polyglot Problems: Difference between revisions

From etwiki
Jump to navigation Jump to search
No edit summary
Line 3: Line 3:
==If-Statements==
==If-Statements==


<syntaxhighlight lang="python" line='line'>
<syntaxhighlight lang='python' line='line'>
if condition:
if condition:
   do_thing
   do_thing
Line 12: Line 12:
</syntaxhighlight>
</syntaxhighlight>


<syntaxhighlight lang="ruby" line='line'>
<syntaxhighlight lang='ruby' line='line'>
if condition
if condition
   do_thing
   do_thing

Revision as of 14:46, 19 July 2021

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 condition:
  do_thing
elif other_condition:
  do_other_thing
else:
  do_else_thing
if condition
  do_thing
elsif other_condition
  do_other_thing
else
  do_else_thing
end