Software Developer
I used table-driven tests to refactor my code. I found this technique in Andrew Gerrand slide while he was talking at Testing Technique in Google I/O 2014. I want to share this technique because it makes my code look better.
C-x C-f = Visit a file
C-x k = exit
C-x C-s = save
C-_ = undo
C-g = ยกเลิก sequence key ที่กดค้างไว้อยู่
สวัสดีค่ะ วันก่อนได้ลองทำโจทย์เล็กๆ โจทย์คือถ้าเวลาอยู่ในช่วงหลังเที่ยงคืนถึงก่อนเที่ยงวันจะ say “Hello, Good morning” ถ้าเวลาจากเที่ยงวันไปถึงหกโมงเย็นจะ say “Hello, Good afternoon” และถ้าเวลาหลังหกโมงเย็นไปถึงเที่ยงคืนจะ say “Hello, Good evening”…
วันหยุดแบบนี้ มาลับสมอง ด้วยโจทย์สนุกๆกัน
วันนี้ไฟที่บ้านดับเพราะมีการซ่อมบำรุงไฟฟ้า ต้องออกจากบ้านมาสิงที่ร้านกาแฟตั้งแต่แปดโมงเช้า สามีเลยชวนให้ฝึก Go ด้วยโจทย์สนุกๆคือ ทำเกม Tic Tac Toe
Zero value ของ type นี้คือ empty stringประเภทข้อมูล string ใน Go สามารถประกาศได้สองแบบ ดังนี้
package mainimport ( "fmt")func main() { var…