Programming/Polyglot Problems: Difference between revisions

From etwiki
Jump to navigation Jump to search
(Created page with "''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?'' {| !Java !C# !Python !Ruby |- |...")
 
No edit summary
Line 1: Line 1:
''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==
!Java
!C#
!Python
!Ruby
|-
|
 
|
|
|
 
|}


<syntaxhighlight lang="python" line='line'>
<syntaxhighlight lang="python" line='line'>
def quick_sort(arr):
if condition:
less = []
  do_thing
pivot_list = []
elif other_condition:
more = []
  do_other_thing
if len(arr) <= 1:
else:
return arr
  do_else_thing
else:
pass
</syntaxhighlight>
</syntaxhighlight>


Line 29: Line 15:
if condition
if condition
   do_thing
   do_thing
elsif
elsif other_condition
   do_other_thing
   do_other_thing
else
else

Revision as of 19:31, 1 February 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