Files
vimx/challenges/code-golf-3-batch-comment.ts
T
fukunee e8dfa0e2f1 Add Vim exercises, cheatsheet, and project polish
Add code golf challenges for Vim practice, a weekly review template, and
extend the cheatsheet with high-frequency commands. Fix the calculator
`multiply` implementation and correct a logger import path.
2026-05-31 23:01:37 +08:00

44 lines
1.2 KiB
TypeScript

// ============================================================
// Code Golf 场景 3:批量加注释
// ============================================================
//
// 目标:给三个函数上面各加一行注释 "// Arithmetic operation: <函数名>"
//
// 💡 提示:用宏!q a 开始录制 → 在第一行编辑 → j → q 停止 → @a 回放
// ============================================================
function add(a: number, b: number): number {
return a + b;
}
function subtract(a: number, b: number): number {
return a - b;
}
function multiply(a: number, b: number): number {
return a * b;
}
// === 目标代码 ===
//
// // Arithmetic operation: add
// function add(a: number, b: number): number {
// return a + b;
// }
//
// // Arithmetic operation: subtract
// function subtract(a: number, b: number): number {
// return a - b;
// }
//
// // Arithmetic operation: multiply
// function multiply(a: number, b: number): number {
// return a * b;
// }
//
// ============================================================
// 我的最佳成绩:
// 日期: ________ 按键数: ________
// 操作日志: ________________________________
// ============================================================