Erinevus lehekülje "JavaPython:String" redaktsioonide vahel

Allikas: Kursused
Mine navigeerimisribale Mine otsikasti
(Uus lehekülg: '{{JavaPython-sisukord}}')
 
1. rida: 1. rida:
 
{{JavaPython-sisukord}}
 
{{JavaPython-sisukord}}
 +
 +
== Näide ==
 +
 +
{|
 +
!Java
 +
!Python
 +
|-
 +
|<syntaxhighlight lang="java" line="1" >
 +
//string
 +
String city = "New York";
 +
String state = "California";//has to be " not '
 +
 +
String lines = "multi-line " +
 +
"string";
 +
</syntaxhighlight>
 +
|<syntaxhighlight lang="python" line="2" >
 +
# Strings
 +
city = "New York"
 +
state = 'California'
 +
 +
# multi-line string
 +
lines = """multi-line
 +
string"""
 +
moreLines = '''multi-line
 +
string'''
 +
</syntaxhighlight>
 +
|}

Redaktsioon: 30. jaanuar 2016, kell 07:40

Java vs Python

Näide

Java Python
<syntaxhighlight lang="java" line="1" >

//string String city = "New York"; String state = "California";//has to be " not '

String lines = "multi-line " + "string"; </syntaxhighlight>

<syntaxhighlight lang="python" line="2" >
  1. Strings

city = "New York" state = 'California'

  1. multi-line string

lines = """multi-line string""" moreLines = multi-line string </syntaxhighlight>