|
Oktatás * Programozás 1 * Szkriptnyelvek Teaching * Programming 1 (BI) Félévek Linkek * kalendárium |
Nim2 /
convert a char digit to intfunc digitToInt(c: char): int = ord(c) - ord('0') let c: char = '5' value1: int = ord(c) - ord('0') # 5 (int) value2: int = digitToInt(c) # 5 (int) echo value1 + value2 # 10 If you need this operation a lot, you can make a helper function for it, like here ( Otherwise, it's done the classical way. The function |
![]() Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |