"String interpolation"의 두 판 사이의 차이

1번째 줄: 1번째 줄:
[[category: String]]
[[category: String]]
;variable interpolation
;variable interpolation
;string interpolation


==Bash==
==Bash==

2014년 5월 31일 (토) 15:06 판

variable interpolation
string interpolation

1 Bash

name=Snoopy
echo "His name is $name"
# His name is Snoopy

2 Perl

my $apples = 4;
print "I have $apples apples\n";

3 PHP

$name = 'Snoopy';
echo "His name is $name"
// His name is Snoopy

4 Python

apples = 4
print "I have %d apples" % apples
print "I have {} apples".format(apples)
print "I have {a} apples".format(a=apples)
# I have 4 apples
# I have 4 apples
# I have 4 apples

5 Ruby

apples = 4
puts "I have #{apples} apples"
# I have 4 apples

6 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}