Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ch1 #113

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Ch1 #113

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions 01-hello.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# 题目: 输入名字,输出 "Hello, 名字"

print "请输入你的名字,然后按 Enter: "
your_name = gets

# ...
your_name = gets

puts "(请替换成最后的答案)"
puts "Hello, #{your_name}"
9 changes: 6 additions & 3 deletions 02-variable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
puts "a 是 #{a}"
puts "b 是 #{b}"

# ...
c = a
a = b
b = c

puts "a 应该是 2,现在是 #{a}"
puts "b 应该是 1,现在是 #{b}"
puts "a \"应该\"是 2,现在是 #{a}"
puts "b \"应该\"是 1,现在是 #{b}"

# 这才是真正的学习了,什么叫 “ ’=’ 是赋值运算符(assignment operator),是指派右边的值到左边的变量”